private void OnCollisionEnter2D(Collision2D collision) { gameObject.GetComponent <CircleCollider2D>().enabled = false; if (collision.gameObject.name == "TT2" || collision.gameObject.name == "TT1") { EnemyText.GetComponent <ParticleSystem>().Play(true); } if (collision.gameObject.name == "TT1") { ActionController.GetComponent <Actions>().Die("TT1"); } else if (collision.gameObject.name == "TT2") { ActionController.GetComponent <Actions>().Die("TT2"); } else { Burst.GetComponent <ParticleSystem>().Play(true); Alien.SetActive(false); StartCoroutine(Die()); ActionController.GetComponent <Actions>().PopIt(); } }
void CheckString(string strKey) { if (!strKey.Equals(listOfStringKeys [selectedEnemy])) { return; } scrEnemyText = listOfEnemies [selectedEnemy].GetComponent <EnemyText> (); scrEnemyText.lockOnImage.SetActive(true); scrEnemyText.DeleteString(); Data.score += charScore; textScore.text = Data.score.ToString(); if (scrEnemyText.listOfStrings.Count.Equals(0)) { scrEnemyText.DestroyEnemy(); scrEnemySummoner.trPlayer.GetComponent <PlayerRotation> ().UnLockOnEnemy(); } else { listOfStringKeys [selectedEnemy] = scrEnemyText.listOfStrings [0]; } scrEnemySummoner.trPlayer.GetComponent <PlayerRotation> ().ShootBullet(scrEnemyText); }
public void ShootBullet(EnemyText enemyTarget) { Transform enemyGO = Instantiate(trBullet, trShootPoint.position, transform.rotation); enemyGO.GetComponent <BulletMovement> ().targetEnemy = enemyTarget; enemyGO.GetComponent <BulletMovement> ().isNotLastBullet = isLockedOn; enemyGO.GetComponent <Rigidbody2D> ().AddForce(trShootPoint.up * bulletForce); }
// Start is called before the first frame update void Start() { animator = GetComponent <Animator>(); spriteRenderer = GetComponent <SpriteRenderer>(); enemiesParent = FindObjectOfType <EnemiesParent>().gameObject; enemyText = FindObjectOfType <EnemyText>(); spawnersText = FindObjectOfType <SpawnersText>(); }
private void Start() { animator = GetComponent <Animator>(); enemyText = FindObjectOfType <EnemyText>(); armorText = FindObjectOfType <ArmorText>(); }