ActivateCharacter() public method

public ActivateCharacter ( string key ) : void
key string
return void
Ejemplo n.º 1
0
    void Update()
    {
        var player = this.GetComponentInParent <Player>();

        if (player.playerId != 1)
        {
            return;
        }

        //Switch between players
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            _characterManager.ActivateCharacter(0);
        }
        else if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            _characterManager.ActivateCharacter(1);
        }
        else if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            _characterManager.ActivateCharacter(2);
        }
        else if (Input.GetKeyDown(KeyCode.Alpha4))
        {
            _characterManager.ActivateCharacter(3);
        }

        //Movement
        if (Input.GetKey(KeyCode.RightArrow))
        {
            this.Send(new MoveInput(1));
        }
        else if (Input.GetKey(KeyCode.LeftArrow))
        {
            this.Send(new MoveInput(-1));
        }
        else
        {
            this.Send(new MoveInput(0));
        }

        //Jump
        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            this.Send(new JumpInput());
        }

        //Attack
        if (Input.GetKeyDown(KeyCode.Space))
        {
            this.Send(new AttackInput());
        }
    }
Ejemplo n.º 2
0
    public void OnEventMessageReceive(CharacterManager sender, EventMessage message)
    {
        switch (message.m_MessageType)
        {
        case EventMessage.MessageType.UPDATE_GOLD:
            CurrentMoney += message.m_IntParam;
            break;

        case EventMessage.MessageType.UPDATE_POWER:
            CurrentPower += message.m_IntParam;
            break;

        case EventMessage.MessageType.ACTIVATE_TILE:
            Vector2 senderPos = sender.Tile.Position;
            switch (message.m_Zone)
            {
            case EventMessage.TriggerZone.SELF:
                sender.ActivateCharacter();
                break;

            case EventMessage.TriggerZone.LEFT:
                TileManager concernedTile = m_BoardManager.Board.GetTile((int)senderPos.x - 1, (int)senderPos.y);
                if (concernedTile != null)
                {
                    concernedTile.ActivateCharacter();
                }
                break;
            }
            break;
        }
    }
Ejemplo n.º 3
0
 public void ActivateCharacter()
 {
     if (CharacterOnTile == null)
         return;
     CharacterOnTile.ActivateCharacter();
 }