// Update is called once per frame void Update() { lockTime -= Time.deltaTime; if (lockTime <= 0) { berserTime -= Time.deltaTime; if (berserTime > 0) { this.gameObject.GetComponent <Rigidbody2D>().mass = 1500; thisZombieScript.getZombieClass().setZombieSpeed(max_Speed); this.gameObject.GetComponent <Rigidbody2D>().freezeRotation = true; } else { lockTime = 1; berserTime = 1; } } else { thisZombieScript.getZombieClass().setZombieSpeed(normalSpeed); gameObject.GetComponent <Rigidbody2D>().mass = 1000; gameObject.GetComponent <Rigidbody2D>().freezeRotation = false; } }
void OnCollisionStay2D(Collision2D col) { if (col.gameObject.tag == "Zombie") { zombieMechanismScript = col.gameObject.GetComponent <ZombieMechanism>(); Setups.survivor.onZombieCollisionPushback(zombieMechanismScript.getZombieClass()); Instantiate(damageParticle, col.gameObject.transform.position, col.gameObject.transform.rotation); } }
// Update is called once per frame void FixedUpdate() { if (exploded == true) { if (current_radius <= explotion_max_size) { Instantiate(explosiveParticle, this.gameObject.transform.position, this.gameObject.transform.rotation); current_radius += explotion_rate; } else { thisZombieMechanism.getZombieClass().getDestroyed(); exploded = false; current_radius = 0; explotion_delay = 1f; } explotion_radius.radius = current_radius; } }