// Use this for initialization void Start() { player_num = GetComponent <Movement> ().player_num; player_camera = GetComponentInChildren <Camera> ().gameObject; cannonScript = GetComponent <ActivateCannon> (); shootingScript = GetComponent <Shooting>(); }
/* * void OnTriggerEnter(Collider other2) { * GameObject other = getParent (other2.gameObject); * ActivateCannon active = other.GetComponent<ActivateCannon> (); * Vector3 defaultRotation = new Vector3 (90, 0, 0); * * // is a player * if (active != null) { * transform.localEulerAngles = defaultRotation; * player = other.gameObject; * active.cannon = this.gameObject; * } * } */ void OnTriggerStay(Collider other2) { GameObject other = getParent(other2.gameObject); ActivateCannon active = other.GetComponent <ActivateCannon> (); // is a player if (active != null) { player = other.gameObject; active.cannon = this.gameObject; } }
void OnTriggerExit(Collider other2) { GameObject other = getParent(other2.gameObject); ActivateCannon active = other.GetComponent <ActivateCannon> (); // is a player if (active != null) { player = null; active.cannon = null; //transform.localEulerAngles = defaultRotation; //GetComponent<ShootAimFort> ().canRotate = false; //this.transform.rotation = GetComponent<ShootAimFort>().startingRotation; } }