public void ChannelLogic(MetaData.ObjectMetaData reciever)
        {
            if (IsReady() || isChanneling || isWinding)
            {
                foreach (EffectScript effectScript in effectScripts)
                {
                    effectScript.Channel(reciever);
                }


                bool commitmentCheck = // Check whether or not to commit stack now.
                                       (stackCommitment == StackCommitment.ONCHANNEL ||
                                        stackCommitment == StackCommitment.ONWIND);

                if ((commitmentCheck && !isChanneling) &&
                    !oneTaken)
                {
                    UseStacks(1);
                }


                isChanneling = true;
                isWinding    = false;
            }
        }
        // State logics

        void WindUpLogic(MetaData.ObjectMetaData reciever)
        {
            if (!isChanneling)
            {
                if (windupTime == 0 && channelTime == 0)
                {
                    isWinding = false;
                    // skip channel step in order to save us from a bit of input lag.
                    WindUp(reciever);
                    Channel(reciever);
                    Trigger(reciever);
                }
                else
                {
                    if (windup > 0)
                    {
                        windup -= Time.deltaTime;
                        WindUp(reciever);
                        sender.AbilityReady(false);
                    }
                    else
                    {
                        isWinding    = false;
                        isChanneling = true;
                        channel      = channelTime;
                    }
                }
            }
        }
 void Trigger(MetaData.ObjectMetaData reciever)
 {
     foreach (Effect effect in effects)
     {
         effect.TriggerLogic(reciever);
     }
 }
        // Particular events in this ability script

        void OnCooldownEvent(float input, MetaData.ObjectMetaData reciever)
        {
            if (activateCooldownSound != null)
            {
                AudioSource.PlayClipAtPoint(activateCooldownSound, sender.transform.position, activateCooldownVolume);
            }
        }
 void Channel(MetaData.ObjectMetaData reciever)
 {
     foreach (Effect effect in effects)
     {
         effect.ChannelLogic(reciever);
     }
 }
 void WindUp(MetaData.ObjectMetaData reciever)
 {
     foreach (Effect effect in effects)
     {
         effect.WindUpLogic(reciever);
     }
 }
 public void OnFireExit(float input, MetaData.ObjectMetaData reciever)
 {
     foreach (Effect effect in effects)
     {
         effect.OnFireExit(input, reciever);
     }
 }
 // For button inputs exclusively
 public void OnFireEnter(float input, MetaData.ObjectMetaData reciever)
 {
     foreach (EffectScript effectScript in effectScripts)
     {
         effectScript.OnFireEnter(input, reciever);
     }
 }
 private void Start()
 {
     healthText = GetComponent <Text>();
     if (gameObject.GetComponentInParent <AbilitySystem.MetaData.ObjectMetaData>() != null)
     {
         metaData = gameObject.GetComponentInParent <AbilitySystem.MetaData.ObjectMetaData>();
     }
 }
 // For inputs
 public void OnFireEnter(float input, MetaData.ObjectMetaData reciever)
 {
     if (cooldown < 0)
     {
         ActivateEvent(input, reciever);
     }
     else
     {
         ActivateEvent(input, reciever);
     }
 }
Esempio n. 11
0
 // Handled by the MetaData
 public void OnUpdate(MetaData.ObjectMetaData objectData)
 {
     if (!oneTime)
     {
         AtUpdate(objectData);
     }
     else
     if (!doneTime)
     {
         AtUpdate(objectData);
     }
 }
Esempio n. 12
0
        public void OnUpdate(float input, MetaData.ObjectMetaData reciever)
        {
            RunTimer();

            foreach (EffectScript effectScript in effectScripts)
            {
                effectScript.OnUpdate(input, reciever);
            }

            // passive logic checks whether or not we have stacks and act accordingly
            PassiveLogic(reciever);
        }
 void ChannelLogic(MetaData.ObjectMetaData reciever)
 {
     if (channel > 0)
     {
         channel -= Time.deltaTime;
         Channel(reciever);
         sender.AbilityReady(false);
     }
     else
     {
         isChanneling = false;
         Trigger(reciever);
         sender.AbilityReady(true);
     }
 }
Esempio n. 14
0
 // Passive is handled by this Effect script.
 private void PassiveLogic(MetaData.ObjectMetaData reciever)
 {
     if (stacks > 0)
     {
         foreach (var effectScript in effectScripts)
         {
             effectScript.Passive(reciever);
         }
     }
     else
     {
         foreach (var effect in effectScripts)
         {
             effect.OnCooldown(reciever);
         }
     }
 }
Esempio n. 15
0
        // Different ability state logics
        // These are operated by the Ability script

        public void WindUpLogic(MetaData.ObjectMetaData reciever)
        {
            oneTaken = false;
            if (IsReady() || isWinding)
            {
                foreach (EffectScript effectScript in effectScripts)
                {
                    effectScript.WindUp(reciever);
                }

                if (stackCommitment == StackCommitment.ONWIND && !isWinding)
                {
                    UseStacks(1);
                }

                isWinding = true;
            }
        }
        public void OnUpdate(float input, MetaData.ObjectMetaData reciever)
        {
            if (!forceScriptCooldown)
            {
                cooldown -= Time.deltaTime;
            }
            else
            {
                float newCool = 0;
                foreach (Effect item in effects)
                {
                    if (newCool < item.Cooldown())
                    {
                        newCool = item.Cooldown();
                    }
                }
                cooldown = newCool;
            }

            foreach (Effect effect in effects)
            {
                if (effect != null)
                {
                    effect.OnUpdate(input, reciever);
                }
                else
                {
                    Debug.Log("<color=red>Error ! Effect is null.</color>\n" +
                              "Please add effect to slot in ability.");
                }
            }
            if (isWinding)
            {
                WindUpLogic(reciever);
            }


            if (isChanneling)
            {
                ChannelLogic(reciever);
            }
        }
        void ActivateEvent(float input, MetaData.ObjectMetaData reciever)
        {
            // reset cooldown
            cooldown = baseCooldown;

            // play sound
            if (activateSound != null)
            {
                AudioSource.PlayClipAtPoint(activateSound,
                                            sender.transform.position, activateVolume);
            }

            // play effects
            foreach (Effect effect in effects)
            {
                effect.OnFireEnter(input, reciever);
            }

            // start windup
            windup    = windupTime;
            isWinding = true;
            WindUpLogic(reciever);
        }
Esempio n. 18
0
        public void TriggerLogic(MetaData.ObjectMetaData reciever)
        {
            if (IsReady() || isChanneling)
            {
                foreach (EffectScript effectScript in effectScripts)
                {
                    effectScript.Trigger(reciever);
                }

                bool commitmentCheck = // Check whether or not to commit stack now.
                                       stackCommitment == StackCommitment.ONTRIGGER ||
                                       stackCommitment == StackCommitment.ONCHANNEL ||
                                       stackCommitment == StackCommitment.ONWIND;

                if (commitmentCheck && !oneTaken)
                {
                    UseStacks(1);
                }

                isChanneling = false;
                isWinding    = false;
                oneTaken     = false;
            }
        }
Esempio n. 19
0
 public virtual void Trigger(MetaData.ObjectMetaData reciever)
 {
 }
Esempio n. 20
0
 public virtual void Channel(MetaData.ObjectMetaData reciever)
 {
 }
Esempio n. 21
0
 public virtual void AtUpdate(MetaData.ObjectMetaData objectData)
 {
     lifeLeft -= Time.deltaTime;
     doneTime  = true;
 }
Esempio n. 22
0
 public virtual void Passive(MetaData.ObjectMetaData reciever)
 {
 }
Esempio n. 23
0
 public virtual void OnCooldown(MetaData.ObjectMetaData reciever)
 {
 }
Esempio n. 24
0
 public virtual void OnFireExit(float input, MetaData.ObjectMetaData reciever)
 {
 }
Esempio n. 25
0
 public virtual void OnUpdate(float input, MetaData.ObjectMetaData reciever)
 {
 }
Esempio n. 26
0
 public virtual void AtDestroy(MetaData.ObjectMetaData objectData)
 {
 }
Esempio n. 27
0
 public virtual void WindUp(MetaData.ObjectMetaData reciever)
 {
 }
Esempio n. 28
0
 // Run by ObjectMetaData once added to it.
 public virtual void AtStart(MetaData.ObjectMetaData objectData)
 {
     lifeLeft = lifeTime;
 }