void Start() { player = GameObject.FindGameObjectWithTag("Player"); playerHealth = player.GetComponent <PlayerHealth>(); rb = GetComponent <Rigidbody>(); boxCollider = GetComponent <BoxCollider>(); moveForward = GetComponent <moveForward>(); }
void assign(int plane, string lane) { string id = "Plane" + (plane - 1); GameObject obj = GameObject.Find(id); if (obj == null) { return; } moveScript = obj.GetComponent <moveForward> (); selectLane(moveScript, lane); Debug.Log("Lane Selected for Plane" + moveScript.index + "is Lane " + lane); }
void selectLane(moveForward mF, string lane) { switch (lane) { case "a": mF.laneA(); break; case "b": mF.laneB(); break; case "c": mF.laneC(); break; } }
void Start() { rb = GetComponent <Rigidbody>(); boxCollider = GetComponent <BoxCollider>(); moveForward = GetComponent <moveForward>(); }