Esempio n. 1
0
        public void addBuff(Buff buff)
        {
            this.BuffList.Add(buff);

            var message = new Messages.TurnActionEventMessage();

            message.turnActionEvent = TurnActionEvent.BuffAttached;
            message.playerId        = this.Id;
            message.buffName        = buff.Name;

            GameServer.Instance.sendMessage(Messages.Type.TURN_ACTION_EVENT, message);
        }
Esempio n. 2
0
        public ServerCharacter destroyServerCharacterRandom()
        {
            var index           = Random.Range(0, this.Field.Count);
            var serverCharacter = this.Field[index];

            this.Field.RemoveAt(index);

            var message = new Messages.TurnActionEventMessage();

            message.turnActionEvent = TurnActionEvent.Destroyed;
            message.instanceId      = serverCharacter.Id;

            GameServer.Instance.sendMessage(Messages.Type.TURN_ACTION_EVENT, message);

            return(serverCharacter);
        }
Esempio n. 3
0
        public ServerCharacter spawnCard(ServerCharacter serverCharacter)
        {
            this.Field.Add(serverCharacter);

            var message = new Messages.TurnActionEventMessage();

            message.turnActionEvent = TurnActionEvent.Instantiated;
            message.playerId        = this.Id;
            message.cardId          = serverCharacter.card.Id;
            message.instanceId      = serverCharacter.Id;
            message.hp     = serverCharacter.HP;
            message.power  = serverCharacter.Power;
            message.attack = serverCharacter.AttackChance;

            GameServer.Instance.sendMessage(Messages.Type.TURN_ACTION_EVENT, message);

            return(serverCharacter);
        }
Esempio n. 4
0
        public void sendChangedMessage()
        {
            {
                var message = new Messages.TurnActionEventMessage();
                message.turnActionEvent = TurnActionEvent.StateChanged;
                message.playerId        = this.Id;
                message.hp   = this.HP;
                message.cost = this.Cost;

                GameServer.Instance.sendMessage(Messages.Type.TURN_ACTION_EVENT, message);
            }

            if (this.HP < 1)
            {
                var message = new Messages.GameEndMessage();
                message.winner = GameServer.Instance.FirstId == this.Id ? GameServer.Instance.SecondId : GameServer.Instance.FirstId;

                GameServer.Instance.sendMessage(Messages.Type.GAME_END, message);
                StateManager.Instance.makeTransition <Server.States.ReadyState>();
            }
        }
 public void onTurnActionEvent(Messages.TurnActionEventMessage message)
 {
     Debug.Log("TurnActionEventMessage");
     onTurnActionEventNotifier.Report(message);
 }