using UnityEngine; using System.Collections; public class PlayerMovement : MonoBehaviour { public float fSpeed = 100; private Vector3 v3fStartingPos; //Called on start up void Start() { v3fStartingPos = transform.position; } //Called once per physics update void FixedUpdate() { print("Debug text"); float fMoveHorizontal = Input.GetAxis("Horizontal"); float fMoveVertical = Input.GetAxis("Vertical"); rigidbody.AddForce(new Vector3(fMoveHorizontal, 0.0f, fMoveVertical) * fSpeed * Time.fixedDeltaTime); } //Called whenever the Player collides with a trigger void OnTriggerEnter(Collider pTrigger) { if (pTrigger.tag == "FallCatcher") OnDeath(); else if (pTrigger.tag == "Mine") OnDeath(); } //Call when the player dies void OnDeath() { transform.position = v3fStartingPos; } }