void Update() { if (close) { if (timer > 0.7F) { close = false; } else { if (Input.GetAxis("Horizontal2") != 0 || Input.GetAxis("Vertical2") != 0) { if (Input.GetAxis("Horizontal2") == -1) { // Take away health from user *one option is to take resources back* tmp = Instantiate(missiles, tr.position, Quaternion.identity) as GameObject; become = tmp.GetComponent <missiles>(); become.father = claimant.transform; tmp.SetActive(true); user.health -= 8; Destroy(gameObject); } else if (Input.GetAxis("Horizontal2") == 1) { ; } else if (Input.GetButtonDown("Vertical2")) { if (Input.GetAxis("Vertical2") == 1) { Player.burstCocked = true; user.health -= 8; Destroy(gameObject); } else if (Input.GetAxis("Vertical2") == -1) { ; } } } timer += Time.deltaTime; } } }
void Awake() { target = transform.parent.gameObject; papi = target.GetComponent <missiles>(); target = papi.target.gameObject; }