Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ public class GA_ExampleBall : MonoBehaviour

void Start ()
{
rigidbody.velocity = new Vector3(Random.value * 0.2f - 0.1f, -1, 0) * Speed;
GetComponent<Rigidbody>().velocity = new Vector3(Random.value * 0.2f - 0.1f, -1, 0) * Speed;
}

void Update()
{
rigidbody.AddForce(Vector3.down * 0.0001f);
rigidbody.velocity = rigidbody.velocity.normalized * Speed;
GetComponent<Rigidbody>().AddForce(Vector3.down * 0.0001f);
GetComponent<Rigidbody>().velocity = GetComponent<Rigidbody>().velocity.normalized * Speed;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ void Update ()
targetVelocity *= Speed;

// Apply a force that attempts to reach our target velocity
Vector3 velocity = rigidbody.velocity;
Vector3 velocity = GetComponent<Rigidbody>().velocity;
Vector3 velocityChange = (targetVelocity - velocity);
velocityChange.x = Mathf.Clamp(velocityChange.x, -MaxVelocityChange, MaxVelocityChange);
velocityChange.y = 0;
velocityChange.z = 0;
rigidbody.AddForce(velocityChange, ForceMode.VelocityChange);
GetComponent<Rigidbody>().AddForce(velocityChange, ForceMode.VelocityChange);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public class GA_ExampleFloor : MonoBehaviour
{
void Start ()
{
renderer.material.color = Color.red;
GetComponent<Renderer>().material.color = Color.red;
}

void OnCollisionEnter(Collision collision)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private void HighScoreWindow(int windowID)
ball.name = "Ball";

transform.position = _startingPosition;
rigidbody.velocity = Vector3.zero;
GetComponent<Rigidbody>().velocity = Vector3.zero;
}

if (!genderComboBoxControl.IsShowingList())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ public class GA_ExampleTarget : MonoBehaviour

void Start ()
{
renderer.material.color = Color.yellow;
GetComponent<Renderer>().material.color = Color.yellow;
}

void Update ()
{
if (!_hit)
{
rigidbody.AddTorque(Vector3.forward * SpinSpeed);
GetComponent<Rigidbody>().AddTorque(Vector3.forward * SpinSpeed);
}
}

Expand All @@ -33,11 +33,11 @@ void OnCollisionEnter(Collision collision)
IEnumerator FlashColor(float duration)
{
_hit = true;
renderer.material.color = Color.green;
GetComponent<Renderer>().material.color = Color.green;

yield return new WaitForSeconds(duration);

_hit = false;
renderer.material.color = Color.yellow;
GetComponent<Renderer>().material.color = Color.yellow;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ public class GA_ExampleWall : MonoBehaviour
{
void Start ()
{
renderer.material.color = Color.gray;
GetComponent<Renderer>().material.color = Color.gray;
}
}
4 changes: 2 additions & 2 deletions Assets/GameAnalytics/Plugins/Framework/Scripts/GA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ public static void HierarchyWindowCallback (int instanceID, Rect selectionRect)

if (GA.SettingsGA.Logo == null)
{
GA.SettingsGA.Logo = (Texture2D)Resources.LoadAssetAtPath("Assets/GameAnalytics/Plugins/Examples/gaLogo.png", typeof(Texture2D));
GA.SettingsGA.Logo = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/GameAnalytics/Plugins/Examples/gaLogo.png", typeof(Texture2D));
if (GA.SettingsGA.Logo == null)
GA.SettingsGA.Logo = (Texture2D)Resources.LoadAssetAtPath("Assets/Plugins/GameAnalytics/Examples/gaLogo.png", typeof(Texture2D));
GA.SettingsGA.Logo = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/Plugins/GameAnalytics/Examples/gaLogo.png", typeof(Texture2D));
}

Graphics.DrawTexture(new Rect(GUILayoutUtility.GetLastRect().width - selectionRect.height - 5 - addX, selectionRect.y, selectionRect.height, selectionRect.height), GA.SettingsGA.Logo);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
// Upgrade NOTE: replaced '_World2Object' with 'unity_WorldToObject'

Shader "Custom/GA_HeatMapSolid"
{
Properties
Expand Down Expand Up @@ -48,7 +51,7 @@ Shader "Custom/GA_HeatMapSolid"

v2f vert(appdata_full v)
{
v.vertex = mul(_Object2World, v.vertex);
v.vertex = mul(unity_ObjectToWorld, v.vertex);
v.normal = normalize(_WorldSpaceCameraPos - v.vertex);
float3 up = float3(0,1,0);
float3 side = normalize(cross(v.normal, up));
Expand All @@ -69,7 +72,7 @@ Shader "Custom/GA_HeatMapSolid"
if(size > 0.0 && size < 1.0)
{
v.vertex.xyz = v.vertex.xyz + (v.texcoord.x * side + v.texcoord.y * up) * max(size * _MaxRadius, 0.1) * 3;
v.vertex = mul(_World2Object, v.vertex);
v.vertex = mul(unity_WorldToObject, v.vertex);
}

v2f o;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
// Upgrade NOTE: replaced '_World2Object' with 'unity_WorldToObject'

Shader "Custom/GA_HeatMapSolidOverlay"
{
Properties
Expand Down Expand Up @@ -47,7 +50,7 @@ Shader "Custom/GA_HeatMapSolidOverlay"

v2f vert(appdata_full v)
{
v.vertex = mul(_Object2World, v.vertex);
v.vertex = mul(unity_ObjectToWorld, v.vertex);
v.normal = normalize(_WorldSpaceCameraPos - v.vertex);
float3 up = float3(0,1,0);
float3 side = normalize(cross(v.normal, up));
Expand All @@ -68,7 +71,7 @@ Shader "Custom/GA_HeatMapSolidOverlay"
if(size > 0.0 && size < 1.0)
{
v.vertex.xyz = v.vertex.xyz + (v.texcoord.x * side + v.texcoord.y * up) * max(size * _MaxRadius, 0.1) * 3;
v.vertex = mul(_World2Object, v.vertex);
v.vertex = mul(unity_WorldToObject, v.vertex);
}

v2f o;
Expand Down Expand Up @@ -144,7 +147,7 @@ Shader "Custom/GA_HeatMapSolidOverlay"

v2f vert(appdata_full v)
{
v.vertex = mul(_Object2World, v.vertex);
v.vertex = mul(unity_ObjectToWorld, v.vertex);
v.normal = normalize(_WorldSpaceCameraPos - v.vertex);
float3 up = float3(0,1,0);
float3 side = normalize(cross(v.normal, up));
Expand All @@ -165,7 +168,7 @@ Shader "Custom/GA_HeatMapSolidOverlay"
if(size > 0.0 && size < 1.0)
{
v.vertex.xyz = v.vertex.xyz + (v.texcoord.x * side + v.texcoord.y * up) * max(size * _MaxRadius, 0.1);
v.vertex = mul(_World2Object, v.vertex);
v.vertex = mul(unity_WorldToObject, v.vertex);
}

v2f o;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
// Upgrade NOTE: replaced '_World2Object' with 'unity_WorldToObject'

Shader "Custom/GA_HeatMapTransparent"
{
Properties
Expand Down Expand Up @@ -52,7 +55,7 @@ Shader "Custom/GA_HeatMapTransparent"

v2f vert(appdata_full v)
{
v.vertex = mul(_Object2World, v.vertex);
v.vertex = mul(unity_ObjectToWorld, v.vertex);
v.normal = normalize(_WorldSpaceCameraPos - (float3)v.vertex);
float3 up = float3(0,1,0);
float3 side = normalize(cross(v.normal, up));
Expand All @@ -62,7 +65,7 @@ Shader "Custom/GA_HeatMapTransparent"
{
up = normalize(cross(side, v.normal));
v.vertex.xyz = v.vertex.xyz + (v.texcoord.x * side + v.texcoord.y * up) * _MaxRadius;
v.vertex = mul(_World2Object, v.vertex);
v.vertex = mul(unity_WorldToObject, v.vertex);
}
v2f o;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
// Upgrade NOTE: replaced '_World2Object' with 'unity_WorldToObject'

Shader "Custom/GA_HeatMapTransparentOverlay"
{
Properties
Expand Down Expand Up @@ -52,7 +55,7 @@ Shader "Custom/GA_HeatMapTransparentOverlay"

v2f vert(appdata_full v)
{
v.vertex = mul(_Object2World, v.vertex);
v.vertex = mul(unity_ObjectToWorld, v.vertex);
v.normal = normalize(_WorldSpaceCameraPos - (float3)v.vertex);
float3 up = float3(0,1,0);
float3 side = normalize(cross(v.normal, up));
Expand All @@ -62,7 +65,7 @@ Shader "Custom/GA_HeatMapTransparentOverlay"
{
up = normalize(cross(side, v.normal));
v.vertex.xyz = v.vertex.xyz + (v.texcoord.x * side + v.texcoord.y * up) * _MaxRadius;
v.vertex = mul(_World2Object, v.vertex);
v.vertex = mul(unity_WorldToObject, v.vertex);
}
v2f o;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
Expand Down
26 changes: 13 additions & 13 deletions Assets/Scripts/Behaviors/AudioBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,18 @@ public virtual void InCombat()
{
if (isMusic == true && isCombatMusic == true)
{
audio.clip = combatMusic[Random.Range(0, combatMusic.Count)];
audio.loop = true;
audio.Play();
GetComponent<AudioSource>().clip = combatMusic[Random.Range(0, combatMusic.Count)];
GetComponent<AudioSource>().loop = true;
GetComponent<AudioSource>().Play();
isCombatMusic = false;
isGameMusic = true;
}

if (hasPlayedAudio == false && !isMusic)
{
audio.clip = combatAudio[1];
audio.loop = true;
audio.Play();
GetComponent<AudioSource>().clip = combatAudio[1];
GetComponent<AudioSource>().loop = true;
GetComponent<AudioSource>().Play();
hasPlayedAudio = true;
}
}
Expand All @@ -91,18 +91,18 @@ public virtual void NotInCombat()
{
if (isMusic == true && isGameMusic == true)
{
audio.clip = gameMusic[Random.Range(0, gameMusic.Count)];
audio.loop = true;
audio.Play();
GetComponent<AudioSource>().clip = gameMusic[Random.Range(0, gameMusic.Count)];
GetComponent<AudioSource>().loop = true;
GetComponent<AudioSource>().Play();
isGameMusic = false;
isCombatMusic = true;
}

if (isMoving == true && !isMusic && !hasPlayedAudio)
{
audio.clip = movementAudio[0];
audio.loop = true;
audio.Play();
GetComponent<AudioSource>().clip = movementAudio[0];
GetComponent<AudioSource>().loop = true;
GetComponent<AudioSource>().Play();
hasPlayedAudio = true;
}

Expand All @@ -113,7 +113,7 @@ public virtual void NotInCombat()

if (!inCombat && !isMusic)
{
audio.loop = false;
GetComponent<AudioSource>().loop = false;
}
}

Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Behaviors/CameraBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void Start()
/// </summary>
public void Update()
{
if (Camera.current != null && Camera.current != this.camera)
if (Camera.current != null && Camera.current != this.GetComponent<Camera>())
return;

// Perform tracking if the camera is set to track an object.
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Behaviors/CombatSystemBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ private void createUnits (IEnumerable<UnitData> units, bool flipHorizontally, fl
unitBehavior.SetFont(font);

if(fontMaterial != null)
unitBehavior.renderer.material = fontMaterial;
unitBehavior.GetComponent<Renderer>().material = fontMaterial;

// Load body parts for the unit.
foreach (NSSNode node in skele.SkeletonStructure.Nodes)
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Behaviors/GUI/AnchorBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void RepositionAnchor()
if (oldPosition == anchorPosition)
return;
if (!hudCamera)
hudCamera = transform.parent.camera;
hudCamera = transform.parent.GetComponent<Camera>();

float aspectRatio = (float)Screen.width / (float)Screen.height;
float height = hudCamera.orthographicSize;
Expand Down
8 changes: 4 additions & 4 deletions Assets/Scripts/Behaviors/GUI/MiniMapGridBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void Start()
newMiniMapPoint.transform.parent = transform;
newMiniMapPoint.name = abc[z].ToString() + x.ToString();
newMiniMapPoint.transform.localPosition = new Vector3(currentXPosition, currentYPosition, -0.01f);
newMiniMapPoint.renderer.enabled = true;
newMiniMapPoint.GetComponent<Renderer>().enabled = true;
currentXPosition = (xPositionOffset + z + 1) * 0.1f + 0.05f;
theMiniMap[z + (x * miniMapWidth)] = newMiniMapPoint;
}
Expand All @@ -78,7 +78,7 @@ void Start()
newMiniMapPlayer = (MiniMapActorBehavior)Instantiate(miniMapPlayer, new Vector3(0, 0.0f, 0.5f), Quaternion.identity);
newMiniMapPlayer.transform.parent = transform;
newMiniMapPlayer.transform.localPosition = new Vector3(0.0f, 0.0f, 0.1f);
newMiniMapPlayer.renderer.enabled = true;
newMiniMapPlayer.GetComponent<Renderer>().enabled = true;
playerSquadList.Add(newMiniMapPlayer);
}

Expand All @@ -88,7 +88,7 @@ void Start()
newMiniMapEnemy = (MiniMapActorBehavior)Instantiate(miniMapEnemy, new Vector3(0, 0.0f, 0.5f), Quaternion.identity);
newMiniMapEnemy.transform.parent = transform;
newMiniMapEnemy.transform.localPosition = new Vector3(0.0f, 0.0f, 0.1f);
newMiniMapEnemy.renderer.enabled = true;
newMiniMapEnemy.GetComponent<Renderer>().enabled = true;

enemySquadList.Add(newMiniMapEnemy);
}
Expand All @@ -99,7 +99,7 @@ void Start()
newMiniMapNuetral = (MiniMapActorBehavior)Instantiate(miniMapNeutral, new Vector3(0, 0.0f, 0.5f), Quaternion.identity);
newMiniMapNuetral.transform.parent = transform;
newMiniMapNuetral.transform.localPosition = new Vector3(0.0f, 0.0f, 0.1f);
newMiniMapNuetral.renderer.enabled = true;
newMiniMapNuetral.GetComponent<Renderer>().enabled = true;

neutralSquadList.Add(newMiniMapNuetral);
}
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Behaviors/Movement/FenceBehavour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class FenceBehavour : MonoBehaviour

void Start ()
{
transform.renderer.enabled = false;
transform.GetComponent<Renderer>().enabled = false;
}


Expand Down
4 changes: 2 additions & 2 deletions Assets/Scripts/Behaviors/Movement/GridBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ public void HideMovePoints()
foreach(MovePointBehavior movePoint in theMap)
{
//change visiblilty of nodes.
if(movePoint && movePoint.renderer.enabled == true)
movePoint.renderer.enabled = false;
if(movePoint && movePoint.GetComponent<Renderer>().enabled == true)
movePoint.GetComponent<Renderer>().enabled = false;
}
}

Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Behaviors/Movement/GridControlBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ private void updateSelectingMovement()
{
// Retrieve the movepoint behavior from the hit target.
MovePointBehavior movePoint = hitInfo.transform.GetComponent<MovePointBehavior>();
if(movePoint == null || !movePoint.renderer.enabled)
if(movePoint == null || !movePoint.GetComponent<Renderer>().enabled)
continue;

// Retrieve the combat squad behavior from the currently-selected squad.
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scripts/Behaviors/Movement/MovePointBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class MovePointBehavior : MonoBehaviour
/// </summary>
public void Start()
{
renderer.enabled = false;
GetComponent<Renderer>().enabled = false;
}

/// <summary>
Expand Down Expand Up @@ -145,7 +145,7 @@ public void HighlightValidNodes(ActorBehavior actor, GridBehavior grid, int rang
moveGraph.RemoveAt(0);

foreach (MovePointBehavior node in moveGraph)
node.renderer.enabled = true;
node.GetComponent<Renderer>().enabled = true;
}

/// <summary>
Expand Down
Loading