Exemple #1
0
        public override void OnEvent(Event evt)
        {
            switch (evt.Type)
            {
            case DestroyEntityEvent.DESTROY_ENTITY: {
                DestroyEntityEvent msg = (DestroyEntityEvent)evt;
                if (this.entity.ID == msg.EntityID && msg.DestroyedByEntityID > 0)
                {
                    int points = entity[Key_PointsAwarded];
                    if (points <= 0)
                    {
                        break;
                    }

                    Entity otherEntity;
                    game.World.Entities.TryGetValue(msg.DestroyedByEntityID, out otherEntity);
                    if (otherEntity == null || otherEntity.IsDead)
                    {
                        break;
                    }

                    AwardPointsEvent awardPointsEvent = AwardPointsEvent.Award(msg.DestroyedByEntityID, points,
                                                                               this.entity.ID);
                    eventManager.Queue(awardPointsEvent);
                }

                break;
            }
            }
        }