コード例 #1
0
        public override void Death()
        {
            List <Player> playerList = (GameWorld.FindAll(p => p is Player).Cast <Player>().ToList());

            foreach (Player p in playerList)
            {
                p.ReceiveExp(0, this);
            }

            //Drop equipment/loot, remove itself from world, etc
            Tile tile = Tile;

            if (tile != null)
            {
                tile.RemoveImmediatly(this);
            }

            LootSack ls = new LootSack(this);

            tile.PutOnTile(ls);

            List <GameObject> changes = new List <GameObject>()
            {
                ls, Inventory, tile.OnTile
            };

            changes.AddRange(Inventory.Objects.Cast <GameObject>().ToList());
            changes.AddRange(Inventory.Items);
            LocalServer.SendToClients(new LevelChangedEvent(changes));

            base.Death();
        }
コード例 #2
0
        public override void PostAnimate()
        {
            int z = Delta.X * 3 + Delta.Y;

            if (Before)
            { //The destination is drawn before the origin so we move the Living object to the tile here, after the animation.
                origin.RemoveImmediatly(toMove);
                destination.PutOnTile(toMove);
            }
        }
コード例 #3
0
        public override void PreAnimate(LocalClient client)
        {
            origin = toMove.Tile;
            if (!Before)
            { //The destination is drawn after the origin so we move the Living object to the tile here, before the animation.
                origin.RemoveImmediatly(toMove);
                destination.PutOnTile(toMove);
                toMove.Position += origin.Position - destination.Position;
            }

            if (!playerSpecific)
            {
                GameEnvironment.AssetManager.PlaySound(soundAssetName);
            }
            else if (Player.LocalPlayerName == LocalPlayerName)
            {
                GameEnvironment.AssetManager.PlaySound(soundAssetName);
            }
        }
コード例 #4
0
        /// <summary>
        /// Puts the Living object on a given tile (if possible)
        /// </summary>
        /// <param name="t">Destination tile</param>
        public virtual void MoveTo(Tile t)
        {
            Tile oldTile = Tile;

            if (oldTile != null)
            {
                oldTile.RemoveImmediatly(this);
            }

            if (!t.PutOnTile(this))
            {
                if (!oldTile.PutOnTile(this))
                {
                    throw new Exception();
                }
            }
            else if (Visible)
            { //Movement animation
                LocalServer.SendToClients(new LivingMoveAnimationEvent(this, t, "Sounds/Footsteps 2 steps"));
            }
        }