예제 #1
0
 void Awake()
 {
     position  = transform.position;
     amount    = healthBonus;
     destroyed = new DispatchOnChange <bool>(GetInstanceID());
     destroyed.NotifyOnValueSet(OnDestroyed);
 }
예제 #2
0
        void Awake()
        {    // Setting the current health when the enemy first spawns.
            _currentHealth = startingHealth;

            mustDestroy = new DispatchOnChange <bool>(GetInstanceID());
            mustDestroy.NotifyOnValueSet(OnDestroyed);
        }
예제 #3
0
        /// <summary>
        ///     Add and Remove callbacks are enabled by the IReactOnAddAndRemove interface
        ///     They are called when:
        ///     an Entity is built in a group  (no swap case)
        ///     an Entity is removed from a group (no swap case)
        /// </summary>
        /// <param name="entityViewStruct">the up to date entity</param>
        /// <param name="previousGroup">where the entity is coming from</param>
        public void Add(ref EnemyAttackEntityViewStruct entityViewStruct, EGID egid)
        {
            var dispatchOnChange = new DispatchOnChange <EnemyCollisionData>(egid);

            dispatchOnChange.NotifyOnValueSet(_onCollidedWithTarget);

            entityViewStruct.targetTriggerComponent.hitChange = dispatchOnChange;
        }