Ejemplo n.º 1
0
        public void ChangeStatus(EntityStatus status)
        {
            // only fire events if the new status is different than the current status
            if (Status != status)
            {
                EntityStatus previousStatus = Status;
                EntityStatus newStatus      = status;

                Status = status;

                if (status == EntityStatus.Dead)
                {
                    EntityDeathEventArgs entityDeathEventArgs = new EntityDeathEventArgs(previousStatus, newStatus, Position);
                    OnDeathEvent(entityDeathEventArgs);
                }
                else if (status == EntityStatus.Active)
                {
                    OnActivatedEvent(EventArgs.Empty);
                }
                else if (status == EntityStatus.Inactive)
                {
                    OnInactivatedEvent(EventArgs.Empty);
                }
            }
        }
Ejemplo n.º 2
0
 private void OnDeathEvent(EntityDeathEventArgs e)
 {
     Utilities.RaiseEvent <EntityDeathEventArgs>(Death, this, e);
 }