コード例 #1
0
    // Start is called before the first frame update
    void Awake()
    {
        networkPosition = new Vector3();
        networkRotation = new Quaternion();

        rigidBody = GetComponent <Rigidbody>();

        _propBlock = new MaterialPropertyBlock();

        specialAbilities = GetComponent <Car_Special_Ability>();

        int abilityChoice = specialAbilities.GetAbilityChoice();
    }
コード例 #2
0
    public void InitizalizeMeter(Car_Special_Ability special)
    {
        specialAbility = special;

        int carChoice = (int)PhotonNetwork.LocalPlayer.CustomProperties["carChoice"];

        // Different cars provide different benefits to charge meter so, Car1 gets charge from being hit, Car2 gets charge over time, and Car3 gets 2 max charges
        if (carChoice > 3)
        {
            maxCharge = 200;
        }
        else if (carChoice == 2 || carChoice == 3)
        {
            StartCoroutine(ChargeOverTime());
        }

        // If abilities aren't enabled for this lobby turn this gameobject off, otherwise activate chosen ability image
        if (!specialAbility.IsAbilityEnabled())
        {
            this.gameObject.SetActive(false);
        }
        else
        {
            int abilityChoice = specialAbility.GetAbilityChoice();

            if (abilityChoice == 0)
            {
                rocketSprite.SetActive(true);
            }
            else if (abilityChoice == 1)
            {
                jumpSprite.SetActive(true);
            }
            else if (abilityChoice == 2)
            {
                teleportSprite.SetActive(true);
            }
        }
    }