Пример #1
0
    protected override void Start()
    {
        base.Start();

        //jump = new Vector3(0.0f, 2.0f, 0.0f); // set jump height value here

        _playerFrozenState = GetComponent <PlayerFrozenState>();
        _animationSwitcher = GetComponent <AnimationSwitcher>();
    }
Пример #2
0
 public void UnFreezeMe()
 {
     // Debug.Log("Unfreezing player " + playerIdentifier.myPlayerNum);
     isActive                      = true;
     turnCounted                   = false;
     playerFrozenState             = PlayerFrozenState.Not_Frozen;
     rb.constraints                = RigidbodyConstraints.None;
     rb.useGravity                 = true;
     myCanvasUpdater.turnText.text = "";
     GetComponentInChildren <WeaponSwitcher>().ResetWeaponCooldowns();
     GetComponent <CharacterController>().enabled   = true;
     GetComponent <FirstPersonController>().enabled = true;
     // Debug.Log(playerFrozenState);
 }
Пример #3
0
    protected override void Start()
    {
        base.Start();

        timeLeft = movementTimeLimit;   // Set the time that the user has to move to the movementTimeLimit

        _holdingState      = GetComponent <PlayerHoldingState>();
        _frozenState       = GetComponent <PlayerFrozenState>();
        _animationSwitcher = GetComponent <AnimationSwitcher>();
        _audioController   = GetComponent <AudioController>();
        _gameOverlay       = GetComponent <GameOverlay>();

        _holdingState.MaxRunWithBallTime = movementTimeLimit;
    }
Пример #4
0
 void Start()
 {
     pickups.AddRange(FindObjectsOfType <Pickup>());
     // otherPlayer = GetComponent<StealthPlayerSwitcher>().otherPlayer;
     maxActionPoints       = myActionPoints;
     playerIdentifier      = GetComponent <PlayerIdentifier>();
     myCanvasUpdater       = myCanvas.GetComponent <PlayerCanvasUpdater>();
     firstPersonController = GetComponent <FirstPersonController>();
     playerFrozenState     = PlayerFrozenState.Frozen;
     rb             = GetComponent <Rigidbody>();
     playerSwitcher = GetComponent <StealthPlayerSwitcher>();
     if (playerIdentifier.myPlayerNum == 0)
     {
         UnFreezeMe();
         // Debug.Log("I'm unfrozen! I am player " + playerIdentifier.myPlayerNum);
     }
     if (playerIdentifier.myPlayerNum == 1)
     {
         FreezeMe();
         // Debug.Log("I'm frozen! I am player " + playerIdentifier.myPlayerNum);
     }
 }
Пример #5
0
    public void TrackPlayerAction()
    {
        //restrict jumping based on AP
        // if(TimeManager.actionPoints < ap_jumpCost){
        //  // firstPersonController.Get
        //  firstPersonController.canJump = false;
        // } else {
        //  firstPersonController.canJump = true;
        // }

        //Deplete AP when you move
        if (playerIdentifier.myPlayerNum == 0)
        {
            if (CrossPlatformInputManager.GetAxisRaw("Horizontal") != 0 || CrossPlatformInputManager.GetAxisRaw("Vertical") != 0)
            {
                // TimeManager.DepleteAP(ap_walkCost);
                if (!firstPersonController.m_Crouching)
                {
                    myActionPoints -= ap_walkCost;
                }
                else if (firstPersonController.m_Crouching)
                {
                    myActionPoints -= ap_walkCost * (firstPersonController.m_WalkSpeed / firstPersonController.m_RunSpeed);
                }
            }
        }

        if (playerIdentifier.myPlayerNum == 1)
        {
            if (CrossPlatformInputManager.GetAxisRaw("P2_Horizontal") != 0 || CrossPlatformInputManager.GetAxisRaw("P2_Vertical") != 0)
            {
                // TimeManager.DepleteAP(ap_walkCost);
                if (!firstPersonController.m_Crouching)
                {
                    myActionPoints -= ap_walkCost;
                }
                else if (firstPersonController.m_Crouching)
                {
                    myActionPoints -= ap_walkCost * (firstPersonController.m_WalkSpeed / firstPersonController.m_RunSpeed);
                }
            }
        }

        if (CrossPlatformInputManager.GetAxisRaw("Mouse X") != 0 || CrossPlatformInputManager.GetAxisRaw("Mouse Y") != 0)
        {
            // TimeManager.DepleteAP(ap_lookCost);
            myActionPoints -= ap_lookCost;
        }

        //deplete AP when you jump and update alert text
        if (GetComponent <JumpScript>().isJumping)
        {
            // float ap_cost = 20f;
            // if(TimeManager.actionPoints >= ap_jumpCost){
            if (myActionPoints >= ap_jumpCost)
            {
                // TimeManager.DepleteAP(ap_jumpCost);
                myActionPoints -= ap_jumpCost;
            }
            else
            {
                TimeManager.apAlertString = "Not enough AP to jump!";
                Invoke("ClearAlertString", 3f);
            }
        }

        //deplete AP when you fire
        if (CrossPlatformInputManager.GetButtonDown("Fire1"))
        {
            // Debug.Log("Lol! You fired!");
            // otherPlayer.GetComponent<PlayerHealthManager>().DepleteHealth(10);
            if (myActionPoints >= ap_attackCost)
            {
                // if(TimeManager.actionPoints >= ap_attackCost){
                // TimeManager.DepleteAP(ap_attackCost);
            }
        }

        if (myActionPoints <= 0)
        {
            // if(TimeManager.actionPoints <= 0){
            playerFrozenState = PlayerFrozenState.Frozen;
            turnEnded         = true;
            // FreezeMe();
            myCanvas.GetComponent <Canvas>().enabled = true;
            Invoke("SwitchToOtherPlayer", 3.5f);
            // SwitchToOtherPlayer();
            return;
        }
    }