Exemplo n.º 1
0
    void Awake()
    {
        if (AllPlayers == null)
        {
            AllPlayers = new List <PlayerController>();
        }
        playerID = GetComponent <PlayerInput>().playerIndex;
        AllPlayers.Insert(playerID, this);
        AIDirector.SetInCombat(this, false);

        cc        = GetComponent <CharacterController>();
        ammoStash = new Dictionary <Weapon.AmmoType, int>();

        bool uh = false; //Needed a bool for some reason

        playerInput = GetComponent <PlayerInput>();
        //playerInput.actions.FindAction("Shoot", uh).performed += ctx => shootInput = true;
        //playerInput.actions.FindAction("Shoot", uh).canceled += ctx => shootInput = false;
        playerInput.actions.FindAction("Shoot", uh).performed  += ctx => ToggleShooting(true);
        playerInput.actions.FindAction("Shoot", uh).canceled   += ctx => ToggleShooting(false);
        playerInput.actions.FindAction("Sprint", uh).performed += ctx => ToggleRun(true);
        playerInput.actions.FindAction("Sprint", uh).canceled  += ctx => ToggleRun(false);
        playerInput.actions.FindAction("Crouch", uh).performed += ctx => ToggleCrouch(true);
        playerInput.actions.FindAction("Crouch", uh).canceled  += ctx => ToggleCrouch(false);

        SetCullingMasks();
        SetUpUI();
        OnPause();//KÄND BUG - Måste börja med UI-actionmappen
    }
Exemplo n.º 2
0
 public void Aggro(PlayerController player)
 {
     animator.SetBool("Aggressive", true);
     AIDirector.SetInCombat(player, true);
 }