Beispiel #1
0
        void OnTriggerEnter2D(Collider2D col)
        {
            Behavior.ITargetable targetableObject = col.gameObject.GetComponent <Behavior.ITargetable>();

            // Set target if it enters the radar zone
            if (targetableObject != null && !targetableObject.Equals(null))
            {
                // Ignore targets that are not `objectToTarget`
                if (targetObjectId != targetableObject.getGameObject().GetInstanceID())
                {
                    return;
                }

                targetBehavior.setTarget(targetableObject);
            }
        }