コード例 #1
0
    private float EndChannel(float _spellDuration, bool _channelState, GameObject _spellInstance)  //gets called after the player ends his channel
    {
        IsChanneling = false;

        if (_spellDuration < 1f)         //if the player pressed the button for less than one second
        {
            _channelState = false;       //channel gets ended WITHOUT spawning the cloud
            ChannleSliderVisual.SetActive(false);
            _spellDuration      = 0f;    //duration of the cloud gets reset
            ChannelSlider.value = _spellDuration;
            Player.GetComponent <PlayerMovement>().enabled = true;
        }
        else if (_spellDuration >= 1f)                   //if the player pressed the button for more than one second
        {
            Player.GetComponent <PlayerMovement>().enabled = true;
            Camera = GameObject.Find("CameraHolder");
            Camera.GetComponent <ObjectFollower>().enabled = false;
            _channelState = false;                       //channel gets ended
            ChannleSliderVisual.SetActive(false);
            DurationSlider.value = _spellDuration * 3;
            DurationSliderVisual.SetActive(true);
            CloudInstance       = Instantiate(Cloud);   //creates an instance of the cloud
            _spellDuration      = 0f;                   //duration of the cloud gets reset
            ChannelSlider.value = _spellDuration;
            return(_spellDuration * 3);
        }
        return(0);
    }
コード例 #2
0
    private void EndEarthChannel()  //gets called after the player ends his channel
    {
        IsChanneling = false;

        if (earthDuration < 1f)         //if the player pressed the button for less than one second
        {
            EarthChannelState = false;  //channel gets ended WITHOUT spawning the cloud
            ChannleSliderVisual.SetActive(false);
            earthDuration       = 0f;   //duration of the cloud gets reset
            ChannelSlider.value = earthDuration;
            Player.GetComponent <PlayerMovement>().enabled = true;
        }
        else if (earthDuration >= 1f)                   //if the player pressed the button for more than one second
        {
            Player.GetComponent <PlayerMovement>().enabled = true;
            Camera = GameObject.Find("CameraHolder");
            //Camera.GetComponent<ObjectFollower>().enabled = false;
            MagicIsActive     = true;
            EarthChannelState = false;                       //channel gets ended

            ChannleSliderVisual.SetActive(false);
            DurationSlider.value = earthDuration * 3;
            DurationSliderVisual.SetActive(true);

            EarthInstance = Instantiate(Earth);         //creates an instance of the cloud

            EarthSpell(earthDuration * 3);              //waterspell gets activated with 2 times the channeltime
            earthDuration       = 0f;                   //duration of the cloud gets reset
            ChannelSlider.value = earthDuration;
        }
    }
コード例 #3
0
    private void FixedUpdate()
    {
        WaterChannelCounter();
        WindChannelCounter();
        EarthChannelCounter();

        DurationSlider.value -= Time.deltaTime;

        if (DurationSlider.value <= 0)
        {
            DurationSlider.value = 0;
            DurationSliderVisual.SetActive(false);
        }
    }