コード例 #1
0
        public override void processMessage(RawMessage message)
        {
            FrankenScientistMinion parentMinion = (FrankenScientistMinion)Engine.Game.getMinionById(message.getInt("iid"));
            ScrapGolemMinion       minion       = parentMinion.createScrapGolem();

            User user = Assets.Scripts.Engine.Game.getUserById(message.getInt("uid"));

            if (user != null)           // random minionlarda null gelebilir.
            {
                minion.ownerPlayer = user.player;
            }

            minion.instanceId                       = message.getInt("sid");
            minion.position                         = new MinionPosition();
            minion.position.pathPosition            = new PathPosition(0, 0);
            minion.position.board                   = Assets.Scripts.Engine.Game.getBoardById(message.getInt("bid"));
            minion.position.pathPosition.pointIndex = message.getInt("cid");
            minion.position.pathPosition.ratio      = message.getFloat("t");

            minion.position.board.AddMinion(minion);
            Runner.Graphics.minion_frankenScientist_spawn(parentMinion, minion);
        }
コード例 #2
0
        public static void sendMessage(ICollection <Player> receiverPlayers, FrankenScientistMinion parentMinion, ScrapGolemMinion spawnedMinion)
        {
            RawMessage msg = new RawMessage();

            msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GMinion_FrankenScientist_spawn)));

            if (receiverPlayers != null && receiverPlayers.Count != 0)
            {
                msg.putInt("iid", parentMinion.instanceId);
                if (spawnedMinion.ownerPlayer != null)
                {
                    msg.putInt("uid", spawnedMinion.ownerPlayer.id);
                }
                else
                {
                    msg.putInt("uid", -1);
                }
                msg.putInt("sid", spawnedMinion.instanceId);
                msg.putInt("bid", spawnedMinion.position.board.instanceId);
                msg.putInt("cid", spawnedMinion.position.pathPosition.pointIndex);
                msg.putFloat("t", spawnedMinion.position.pathPosition.ratio);

                foreach (var receiverPlayer in receiverPlayers)
                {
                    receiverPlayer.user.session.client.SendMessage(msg);
                }
            }
        }
コード例 #3
0
ファイル: GraphicsGame.cs プロジェクト: btasdoven/ScienceWars
 public void minion_frankenScientist_spawn(FrankenScientistMinion parentMinion, ScrapGolemMinion spawnedMinion)
 {
     createMinion(spawnedMinion);
 }