public void Initialize(Vector3 worldPosition, EnemyCore controller) { pos1 = new Vector3(worldPosition.x - _size, transform.position.y + 1f, worldPosition.z - _size); pos2 = new Vector3(worldPosition.x + _size, transform.position.y + 1f, worldPosition.z + _size); Parent = controller; isActive = true; NewLoop(); _NewPoint = true; }
private void OnCollisionEnter(Collision collision) { pc = collision.collider.GetComponent <PlayerController>(); tmpBB = collision.collider.GetComponent <BarrelBehaviour>(); tempEn = collision.collider.GetComponent <EnemyCore>(); if (pc != null) { PlayerController.instance.HandleDamage(damage); } if (tmpBB) { tmpBB.Explose(); } if (tempEn) { tempEn.Damage(10000000); } }
void Explode() { Vector3 explosionPos = transform.position; Collider[] colliders = Physics.OverlapSphere(transform.position, radius); foreach (Collider hit in colliders) { Rigidbody rb = hit.GetComponent <Rigidbody>(); TumoEDU.EnemyCore enemy = hit.GetComponent <TumoEDU.EnemyCore> (); if (rb != null) { rb.AddExplosionForce(power, explosionPos, radius, 3.0F, ForceMode.Impulse); } if (enemy != null) { enemy._HP -= 100; } } Destroy(gameObject); }
void Update() { if (lvlcomplite0) { enemy0 = GameObject.FindGameObjectWithTag("Enemy"); txt.text = "Aim at the <color=#ff0000>Enemy</color> and <color=#00ff44>Shot</color>!"; TumoEDU.EnemyCore enemy00 = enemy0.GetComponent <TumoEDU.EnemyCore> (); if (enemy00 == null) { txt.text = "<color=#00ff44>Good!</color>!"; lvlcomplite0 = false; StartCoroutine(tutor1()); } } if (lvlcomplite1) { enemy0 = GameObject.FindGameObjectWithTag("Enemy"); enemy0.transform.rotation = Quaternion.Euler(0f, 0f, 0f); TumoEDU.EnemyCore enemy00 = enemy0.GetComponent <TumoEDU.EnemyCore> (); if (enemy00 == null) { txt.text = "<color=#00ff44>Done!</color>!"; StartCoroutine(tutor2()); lvlcomplite1 = false; } } if (lvlcomplite2) { enemy0 = GameObject.FindGameObjectWithTag("Enemy"); enemy0.transform.rotation = Quaternion.Euler(0f, 0f, 0f); TumoEDU.EnemyCore enemy00 = enemy0.GetComponent <TumoEDU.EnemyCore> (); if (enemy00 == null && Player.GetComponent <WeaponSwitch>().Riffle) { txt.text = "<color=#00ff44>Awesome!</color>!"; StartCoroutine(tutor3()); txt.fontSize = 26; lvlcomplite2 = false; } } if (lvlcomplite3) { if (GameManager.instance.PeaceCount > 0) { txt.text = "<color=#00ff44>Yes!</color>!"; StartCoroutine(tutor4()); lvlcomplite3 = false; } } if (lvlcomplite4) { if (Player.GetComponent <TumoEDU.PlayerController> ()._HP >= 80) { txt.text = "<color=#00ff44>Done!</color>!"; StartCoroutine(tutor5()); txt.fontSize = 26; lvlcomplite4 = false; } } if (lvlcomplite5) { enemy0 = GameObject.FindGameObjectWithTag("Enemy"); enemy0.transform.rotation = Quaternion.Euler(0f, 0f, 0f); TumoEDU.EnemyCore enemy00 = enemy0.GetComponent <TumoEDU.EnemyCore> (); if (enemy00 == null && Player.GetComponent <WeaponSwitch>().RPG) { txt.text = "<color=#00ff44>Yeey!</color>!"; StartCoroutine(tutor6()); lvlcomplite5 = false; } } if (lvlcomplite6) { enemy0 = GameObject.FindGameObjectWithTag("Enemy"); TumoEDU.EnemyCore enemy00 = enemy0.GetComponent <TumoEDU.EnemyCore> (); try{ gr = GameObject.Find("Grenade(Clone)"); }catch { } if (gr != null) { grr = true; } if (enemy00 == null && grr) { txt.text = "<color=#00ff44>Boom!</color>!"; StartCoroutine(tutor7()); lvlcomplite6 = false; } } if (lvlcomplite7) { if (UpgradeTrigger.IsInTrigger && Input.GetKeyDown(KeyCode.F)) { txt.text = "<color=#00ff44>Done!</color>!"; StartCoroutine(finish()); lvlcomplite7 = false; } } }
private void Start() { E_C = GetComponent <EnemyCore>(); EnemyTriggers.Add(this); }
public void Initialize(EnemyCore E_c) { Parent = E_c; }