Browse Source

Changes Icon animation

master
Joshua Reason 8 years ago
parent
commit
3eac0fd1bc
6 changed files with 46 additions and 12 deletions
  1. BIN
      unity_Project/Assets/GUI Assets/Icon - PULL.controller
  2. BIN
      unity_Project/Assets/GUI Assets/icon_PUSH.anim
  3. +7
    -2
      unity_Project/Assets/Scripts/impactSFX_crate.cs
  4. +35
    -6
      unity_Project/Assets/Scripts/movebetween.cs
  5. +4
    -4
      unity_Project/Assets/Scripts/sceneController.cs
  6. BIN
      unity_Project/Assets/_Scenes/MainLevel.unity

BIN
unity_Project/Assets/GUI Assets/Icon - PULL.controller View File


BIN
unity_Project/Assets/GUI Assets/icon_PUSH.anim View File


+ 7
- 2
unity_Project/Assets/Scripts/impactSFX_crate.cs View File

@ -12,6 +12,8 @@ public class impactSFX_crate : MonoBehaviour {
private float pitchHighRange = 1.0f; // Pitch High Range
private float pitchDefault = 1.0f; // Pitch Default Value
private float lastHitTime = 0.0f;
private float waitTime = 0.5f;
// FUNCTION: Find Audio Source component (attached to Player Avatar Object)
void Awake(){
source = GetComponent<AudioSource> ();
@ -20,8 +22,11 @@ public class impactSFX_crate : MonoBehaviour {
void PlayImpCrate(){
source.pitch = Random.Range (pitchLowRange, pitchHighRange);
source.PlayOneShot (sfxImpCrate,0.85f);
if (Time.time > lastHitTime + waitTime) {
lastHitTime = Time.time;
source.pitch = Random.Range (pitchLowRange, pitchHighRange);
source.PlayOneShot (sfxImpCrate, 0.85f);
}
}

+ 35
- 6
unity_Project/Assets/Scripts/movebetween.cs View File

@ -3,17 +3,23 @@ using System.Collections;
public class movebetween : MonoBehaviour {
public GameObject start;
public GameObject end;
public GameObject[] points;
//public GameObject end;
public float distance;
public float changeDis;
private Vector3 startPos;
private Vector3 endPos;
public int count = 0;
public bool useCustomRotation = false;
private Rigidbody rb;
void Start(){
startPos = start.transform.position;
endPos = end.transform.position;
rb = gameObject.GetComponent<Rigidbody> ();
startPos = points[count].transform.position;
endPos = points[count+1].transform.position;
distance = Vector3.Distance (startPos, endPos) / Vector3.Distance (gameObject.transform.position, startPos);
}
@ -21,12 +27,35 @@ public class movebetween : MonoBehaviour {
// Update is called once per frame
void Update () {
transform.position = startPos + (endPos - startPos) / distance;
//transform.position = startPos + (endPos - startPos) / distance;
if (!useCustomRotation) {
Vector3 lookAtTarget = endPos;
lookAtTarget.y = transform.position.y;
transform.LookAt (lookAtTarget);
}
}
void FixedUpdate(){
if (Vector3.Distance (gameObject.transform.position, startPos) <= changeDis && count != 0) {
count--;
startPos = points[count].transform.position;
endPos = points[count+1].transform.position;
}
if (Vector3.Distance (gameObject.transform.position, endPos) <= changeDis && count + 1 != points.Length) {
count++;
startPos = points[count].transform.position;
endPos = points[count+1].transform.position;
}
distance = Vector3.Distance (startPos, endPos) / Vector3.Distance (gameObject.transform.position, startPos);
Vector3 newPos = gameObject.transform.position;
newPos.x = startPos.x + (endPos.x - startPos.x) / distance;
newPos.y = startPos.y + (endPos.y - startPos.y) / distance;
rb.MovePosition (newPos);
}
}

+ 4
- 4
unity_Project/Assets/Scripts/sceneController.cs View File

@ -11,8 +11,8 @@ public class sceneController : MonoBehaviour {
public GameObject crossHairPlayer1;
public GameObject crossHairPlayer2;
public GameObject playerPointer;
public Animator push;
public Animator pull;
//public Animator push;
public Animator icon;
public float screenAnimationTime;
@ -87,7 +87,7 @@ public class sceneController : MonoBehaviour {
oldCamera = cameraPlayer2;
crossHairPlayer1.SetActive(true);
crossHairPlayer2.SetActive(false);
pull.SetTrigger("appear");
icon.SetTrigger("p1");
@ -96,7 +96,7 @@ public class sceneController : MonoBehaviour {
oldCamera = cameraPlayer1;
crossHairPlayer1.SetActive(false);
crossHairPlayer2.SetActive(true);
push.SetTrigger("appear");
icon.SetTrigger("p2");
}

BIN
unity_Project/Assets/_Scenes/MainLevel.unity View File


Loading…
Cancel
Save