Пример #1
0
        void MakeLiving(PlayerSettings playerSettings)
        {
            var mainEngineParticles = playerSettings.GetComponent <PlayerMainEngineParticles>();

            mainEngineParticles.ChangeColor(playerSettings.color);
            var weaponSlot = playerSettings.GetComponent <WeaponSlot>();

            weaponSlot.enabled = true;
        }
Пример #2
0
        void MakeUndead(PlayerSettings playerSettings)
        {
            var mainEngineParticles = playerSettings.GetComponent <PlayerMainEngineParticles>();

            mainEngineParticles.ChangeColor(UndeadColor);
            var weaponSlot = playerSettings.GetComponent <WeaponSlot>();

            weaponSlot.enabled = false;
        }
Пример #3
0
    // Use this for initialization
    void Start()
    {
        // setting timer


        PlayerSettings shorter = playerSet.GetComponent <PlayerSettings>();

        //line below is for testing if first turn timer will work. delete later.
        playerSet.setTimerFirstEnabled(true);

        if (shorter.getTimerFirstEnabled())
        {
            startTime = shorter.getTimerFirst();
            firstRun  = true;
        }
        else
        {
            startTime = shorter.getTimer();
        }
        TimeLeft = startTime;
    }
Пример #4
0
    void Function()
    {
        /*Even with it set properly above, you need to do .GetComponent<ScriptName>()
         * anything following are the functions that are within that script. Here I'm setting the timer*/
        settings.GetComponent <PlayerSettings>().setTimer(40);

        /*you need to do the above everytime you call a function... it's a pain
         * BUT you can do something like the below to make it shorter to type.*/
        PlayerSettings shorter = settings.GetComponent <PlayerSettings>();

        /*BUT it can only be done inside a Function, you can't use .GetComponent on a global variable.
         * which is why it's down here, inside the Function, instead of at the top, outside the Function.*/

        //Here's how you'd use the shorter version.
        shorter.setTimerFirstEnabled(true);
        //if you copy/paste these scripts, don't call it "shorter" lol

        //When you use a get~ function, you need to store it in a local variable.
        int Timer = shorter.getTimer();

        /*If you're doing a script that actually counts down the timer you'd countdown your local variable
         * when you need to start your timer again, run the getTimer function again.
         * we shouldn't need to store temporary variables in the PlayerSettings script*/
    }