CharacterManager.ActivateCharacter C# (CSharp) Method

ActivateCharacter() public method

public ActivateCharacter ( string key ) : void
key string
return void
    public void ActivateCharacter(string key)
    {
        isCharActive [key] = true;
        Debug.Log(key + " has been activated");
    }

Usage Example

Exemplo 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());
        }
    }
All Usage Examples Of CharacterManager::ActivateCharacter