Exemple #1
0
        // Use this for initialization
        void Start()
        {
            _health    = 9;
            _maxHealth = 10;
            _gm        = FindObjectOfType <GameManager.GameManager>();
            _gm.SetPlayer(this, playerIndex);

            switch (playerIndex)
            {
            case 0:
                _gm.GetComponent <InputManager>().p1InputDelegate += RespondToInput;
                break;

            case 1:
                _gm.GetComponent <InputManager>().p2InputDelegate += RespondToInput;
                break;

            case 2:
                _gm.GetComponent <InputManager>().p3InputDelegate += RespondToInput;
                break;

            case 3:
                _gm.GetComponent <InputManager>().p4InputDelegate += RespondToInput;
                break;

            default:
                break;
            }
        }