} // end OnCollisionEnter ////////page 713 void OnTriggerEnter(Collider other) { EnemySpiker spiker = other.GetComponent<EnemySpiker>(); if (spiker != null) { // CollisionDamage() will see spiker as an Enemy CollisionDamage(spiker); } }
} // end OnCollisionEnter ////////page 713 void OnTriggerEnter(Collider other) { EnemySpiker spiker = other.GetComponent<EnemySpiker>(); if (spiker != null) { // CollisionDamage() will see spiker as an Enemy CollisionDamage(spiker); // CollisionDamage(other.gameObject); // COMMENT OUT THIS LINE! } }
private void OnTriggerEnter(Collider other) { EnemySpiker spiker = other.GetComponent <EnemySpiker>(); if (spiker != null) { CollisionDamage(spiker); } }
void OnTriggerEnter(Collider other) { EnemySpiker spiker = other.GetComponent <EnemySpiker>(); if (spiker != null) { CollisionDamage(spiker); //CollisionDamage(other.gameObject); } }
void OnTriggerStay(Collider other) { EnemySpiker recipient = other.GetComponent <EnemySpiker>(); if (recipient != null) { recipient.Damage(damagePerSecond, ElementType.earth, true); //recipient.speed = 0; } }
private void OnTriggerEnter(Collider other) { EnemySpiker spiker = other.GetComponent <EnemySpiker>(); if (spiker != null) { // CollisionDamage() будет видеть спираль как врага CollisionDamage(spiker); //CollisionDamage(other.gameObject); } }
private void OnTriggerStay(Collider other) { //获取EnemySpiker脚本 recipient_spiker = other.GetComponent <EnemySpiker>(); //如果有,则将其减速 if (recipient_spiker != null) { recipient_spiker.NormalMove = false; } }
void OnTriggerStay(Collider other) { // Actually damage the other // Get a reference to the EnemyBug script component of the other EnemySpiker recipient = other.GetComponent <EnemySpiker>(); // If there is an EnemyBug component, dmage it with fire if (recipient != null) { //recipient.Damage(damagePerSecond, ElementType.earth, true); //recipient.moveDir *= -1; //Destroy(gameObject); // Make sure that the ground tile is in the direction we're moving. // A dot product will help us with this (see the Useful Concepts // Reference). float dot = Vector3.Dot(recipient.moveDir, gameObject.transform.position - recipient.pos); if (dot > 0) { // If Spiker is moving towards the block it hit recipient.moveDir *= -1; // Reverse direction } } }