(!P_CheckSight(actor, actor->target)) return false; // can’t see the target if (actor->reactiontime) return false; // do not attack yet dist = P_AproxDistance (actor, target) - 64*FRACUNIT; // no melee attack, so fire more if (!actor->info->meleestate) dist-=128*FRACUNIT; // check for ARCH-VILE if (actor->type == MT_VILE){ if (dist > 14*64) return false; // too far away } ...
// If the player enters the trigger zone... if(other.tag == "Player") { // Get a reference to the player health script. PlayerHealth playerHealth = other.GetComponent<PlayerHealth>(); playerHealth.health += healthBonus; // Trigger a new delivery. pickupSpawner.StartCoroutine( pickupSpawner.DeliverPickup()); // Destroy the crate. Destroy(transform.root.gameObject); } }
reuse components/behaviors • easy to make new object types • dynamic typing • all dependencies are to be linked together • hard to debug • messaging hell 32