Ejemplo n.º 1
0
        private void OnTilePlaced(TileChangedEventArgs args)
        {
            //Debug.Print("OnTilePlaced!");

            var player = args.Player;

            if (!CanBuild(args.TileX, args.TileY, player))
            {
                Debug.Print("Cannot build here.");
                return;
            }

            if (!PlayerTileTracker.HasModifiedTile(player.Name, args.TileX, args.TileY))
            {
                PlayerTileTracker.ModifyTile(player.Name, args.TileX, args.TileY);

                if (args.Player != null)
                {
                    var reward = new MiningReward(args.Player, args.GetTypeOrWall(), args.TileSubTarget, RewardReason.Placing);
                    RewardDistributor.EnqueueReward(reward);
                }
            }
            else
            {
                Debug.Print("Already placed.");
            }
        }
Ejemplo n.º 2
0
        private void OnTileKilled(TileChangedEventArgs args)
        {
            //Debug.Print("OnTileKilled!");

            var player = args.Player;

            if (!CanBuild(args.TileX, args.TileY, player))
            {
                Debug.Print("Cannot build here.");
                return;
            }

            if (!PlayerTileTracker.HasModifiedTile(player.Name, args.TileX, args.TileY))
            {
                //ignore walls and grass.. this should be filtered already...
                //if( tile.collisionType > 0 )
                {
                    PlayerTileTracker.ModifyTile(player.Name, args.TileX, args.TileY);

                    if (player != null)
                    {
                        var reward = new MiningReward(player, args.GetTypeOrWall(), args.TileSubTarget, RewardReason.Mining);
                        RewardDistributor.EnqueueReward(reward);
                    }
                }
            }
            else
            {
                Debug.Print("Already destroyed.");
            }
        }