Exemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        if (vehicleInputScript != null)
        {
            int _playerNum = vehicleInputScript.getPlayerNum();
            switch (_playerNum)
            {
            case 1:
                gameObject.transform.parent.gameObject.layer = 14;     //current layer for "Player1"
                break;

            case 2:
                gameObject.transform.parent.gameObject.layer = 15;     //current layer for "Player2"
                break;

            case 3:
                gameObject.transform.parent.gameObject.layer = 18;     //current layer for "Player3"
                break;

            case 4:
                gameObject.transform.parent.gameObject.layer = 19;     //current layer for "Player4"
                break;
            }
        }
        else
        {
            Debug.Log("You forgot to give: "
                      + gameObject.transform.parent.parent.parent.parent.parent.parent.name + "'s crosshair a reference!");
        }
    }
Exemplo n.º 2
0
    void Start()
    {
        arrP = GameObject.FindObjectsOfType <VehicleInput>();

        foreach (VehicleInput p in arrP)
        {
            VehicleInput v = p.gameObject.GetComponent <VehicleInput>();
            if (p.gameObject.GetComponent <SphereCarController>().tiltShift.gameObject != null)
            {
                Camera c = p.gameObject.GetComponent <SphereCarController>().tiltShift.gameObject.GetComponent <Camera>();
                if (arrP.Length == 2)
                {
                    setUp_2(v.getPlayerNum(), c);
                }
                else if (arrP.Length > 2)
                {
                    setUp_3_4(v.getPlayerNum(), c);
                }
            }
        }
    }
Exemplo n.º 3
0
    /*private IEnumerator ChangeFOV()
     * {
     * // Debug.Log("Change FOV was called!");
     *  while(true)
     *  {
     *      if(rayCastCar.isBoosting == true)
     *      {//you are boosting
     *         // Debug.Log("Car is boosting!");
     *         if(_vehicleInput != null)
     *          { // if human player
     *              if (cineCamera.m_Lens.FieldOfView < carFovBoost)
     *              {
     *                  //Debug.Log("Car FOV was increased from: " + cineCamera.m_Lens.FieldOfView);
     *                  cineCamera.m_Lens.FieldOfView += carFovChangeAmount;
     *                  // Debug.Log(" to: " + cineCamera.m_Lens.FieldOfView);
     *              }
     *              else
     *              {
     *                  cineCamera.m_Lens.FieldOfView = carFovBoost;
     *                  yield break;
     *              }
     *          }
     *
     *      }
     *      if(rayCastCar.isBoosting == false)
     *      {
     *          if (_vehicleInput != null)
     *          { // if human player
     *              if (cineCamera.m_Lens.FieldOfView > carFovStandard)
     *              {
     *                  cineCamera.m_Lens.FieldOfView -= carFovChangeAmount;
     *              }
     *              else
     *              {
     *                  cineCamera.m_Lens.FieldOfView = carFovStandard;
     *                  yield break;
     *              }
     *          }
     *      }
     *      yield return new WaitForSeconds(carFovChangeRate);
     *  }
     * }*/

    // Handles the ability call, on what input it is, if it can be used, and if it can be held down
    private bool fireAbility(Ability ability, bool canFire, Image abilityCooldown, GameObject abilityDark, GameObject abilityBG, char flagChar)
    {
        if (canFire && ability != null && (!isAI || AIAbilityBehaviour.acquireToken()))
        {
            if (_vehicleInput != null)
            {
                abilityCooldown.fillAmount = 1;
                abilityDark.SetActive(true);
                abilityBG.SetActive(true);
                StartCoroutine(FillReset(abilityBG));
                tracker.awardUpdate(flagChar, _vehicleInput.getPlayerNum());
            }
            else
            {
                Invoke("returnToken", RaceManager.tokenRefreshTime);
            }
            ability.ActivateAbility();

            return(true);
        }
        return(false);
    }
Exemplo n.º 4
0
    // Start is called before the first frame update
    void Start()
    {
        arenaStatus.SetActive(false);
        if (GameObject.FindGameObjectWithTag("GameManager") != null)
        {
            _hypeManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <HypeManager>();
            _rm          = GameObject.FindGameObjectWithTag("GameManager").GetComponent <RaceManager>();
        }
        else
        {
            Debug.LogWarning("Game Manager Can Not be Found");
        }
        int numPlayers = 1;

        if (DataManager.instance != null)
        {
            numPlayers = DataManager.instance.getNumActivePlayers();
            _dm        = DataManager.instance;
        }
        else
        {
            Debug.LogWarning("Data Manager Can Not be Found");
        }

        int playerNum = vehicleInputScript.getPlayerNum();

        _chb = vehicleInputScript.GetComponent <CarHealthBehavior>();

        _raycastCarHolder = vehicleInputScript.GetComponent <RaycastCar>();
        _dm.playerUIDictionary.Add(_raycastCarHolder.playerID, this);

        //Old Attack Indicator Setup

        /*
         * if (numPlayers > 1)
         * {
         *  _heightOffset = 0.057f;
         *  for (int i = 0; i < attackIndicators.Count; i++)
         *  {
         *      attackIndicators[i].transform.localScale = multiplePlayerScale;
         *  }
         * }
         * else
         * {
         *  for (int i = 0; i < attackIndicators.Count; i++)
         *  {
         *      attackIndicators[i].transform.localScale = onePlayerScale;
         *  }
         * }
         */
        switch (playerNum)
        {
        case 1:     //is player 1
            if (numPlayers == 2)
            {
                offSetVector = new Vector3(0, localCam.pixelHeight, 0);
            }
            else if (numPlayers >= 3)
            {
                offSetVector = new Vector3(0, localCam.pixelHeight, 0);
            }
            break;

        case 2:     //is player 2
            if (numPlayers >= 3)
            {
                offSetVector = new Vector3(localCam.pixelWidth, localCam.pixelHeight, 0);
            }
            break;

        case 3:     //is player 3
            offSetVector = new Vector3(0, 0, 0);
            break;

        case 4:     //is player 4
            offSetVector = new Vector3(localCam.pixelWidth, 0, 0);
            break;
        }
        //Legacy Hype and Pole position Setters, Assigned per player
        //hypeText.color = Color.cyan;
        //hypeDisplay.sprite = hypeDisplayColors[playerNum - 1];
        //poleBean.sprite = beanSprites[playerNum - 1];
    }
Exemplo n.º 5
0
 private void driftUpdate()
 {
     players.playerInfo[playerNum.getPlayerNum() - 1].driftTimer += .1f;
 }