Esempio n. 1
0
        private void SetupScriptableObjects()
        {
            //Debug.Log(gameObject.name + ".EnvironmentalEffectArea.SetupScriptableObjects()");
            if (SystemAbilityEffectManager.MyInstance == null)
            {
                Debug.LogError(gameObject.name + ": SystemAbilityEffectManager not found.  Is the GameManager in the scene?");
                return;
            }

            if (abilityEffectNames != null)
            {
                foreach (string abilityEffectName in abilityEffectNames)
                {
                    if (abilityEffectName != string.Empty)
                    {
                        AbilityEffect tmpAbilityEffect = SystemAbilityEffectManager.MyInstance.GetResource(abilityEffectName);
                        if (tmpAbilityEffect != null)
                        {
                            abilityEffects.Add(tmpAbilityEffect);
                        }
                        else
                        {
                            Debug.LogError(gameObject.name + ".EnvironmentalEffectArea.SetupScriptableObjects(): Could not find ability effect " + abilityEffectName + " while initializing " + gameObject.name + ". Check inspector.");
                        }
                    }
                    else
                    {
                        Debug.LogError(gameObject.name + ".EnvironmentalEffectArea.SetupScriptableObjects(): Ability Effect name was empty while initializing " + gameObject.name + ". Check inspector.");
                    }
                }
            }
        }
Esempio n. 2
0
        public virtual void PerformChanneledEffect(BaseCharacter source, GameObject target)
        {
            //Debug.Log("BaseAbility.PerformChanneledEffect(" + MyName + ", " + (source == null ? "null" : source.name) + ", " + (target == null ? "null" : target.name) + ")");
            foreach (AbilityEffect abilityEffect in channeledAbilityEffects)
            {
                AbilityEffect _abilityEffect = SystemAbilityEffectManager.MyInstance.GetNewResource(abilityEffect.MyName);

                // channeled effects need to override the object lifetime so they get destroyed at the tickrate
                //_abilityEffect.MyAbilityEffectObjectLifetime = tickRate;
                _abilityEffect.Cast(source, target, target, null);
            }
        }
Esempio n. 3
0
 public AbilityEffect GetNewResource(string resourceName)
 {
     //Debug.Log(this.GetType().Name + ".GetResource(" + resourceName + ")");
     if (!RequestIsEmpty(resourceName))
     {
         string keyName = prepareStringForMatch(resourceName);
         if (resourceList.ContainsKey(keyName))
         {
             AbilityEffect returnValue = ScriptableObject.Instantiate(resourceList[keyName]) as AbilityEffect;
             returnValue.SetupScriptableObjects();
             return(returnValue);
         }
     }
     return(null);
 }
Esempio n. 4
0
        public override void SetupScriptableObjects(SystemGameManager systemGameManager)
        {
            base.SetupScriptableObjects(systemGameManager);

            if (petEffectNames != null)
            {
                foreach (string petEffectName in petEffectNames)
                {
                    AbilityEffect abilityEffect = systemDataFactory.GetResource <AbilityEffect>(petEffectName);
                    if (abilityEffect != null && ((abilityEffect as SummonEffect) is SummonEffect))
                    {
                        petEffectList.Add(abilityEffect as SummonEffect);
                    }
                    else
                    {
                        Debug.LogError("SystemAbilityManager.SetupScriptableObjects(): Could not find ability effect : " + petEffectName + " while inititalizing " + DisplayName + ".  CHECK INSPECTOR");
                    }
                }
            }
        }
Esempio n. 5
0
 public override void SetupScriptableObjects()
 {
     base.SetupScriptableObjects();
     channeledAbilityEffects = new List <AbilityEffect>();
     if (channeledAbilityEffectnames != null)
     {
         foreach (string abilityEffectName in channeledAbilityEffectnames)
         {
             AbilityEffect abilityEffect = SystemAbilityEffectManager.MyInstance.GetResource(abilityEffectName);
             if (abilityEffect != null)
             {
                 channeledAbilityEffects.Add(abilityEffect);
             }
             else
             {
                 Debug.LogError("SystemAbilityManager.SetupScriptableObjects(): Could not find ability effect: " + abilityEffectName + " while inititalizing " + MyName + ".  CHECK INSPECTOR");
             }
         }
     }
 }
Esempio n. 6
0
        public override void SetupScriptableObjects()
        {
            base.SetupScriptableObjects();

            realPetEffectList = new List <AbilityEffect>();
            if (petEffectNames != null)
            {
                foreach (string petEffectName in petEffectNames)
                {
                    AbilityEffect abilityEffect = SystemAbilityEffectManager.MyInstance.GetResource(petEffectName);
                    if (abilityEffect != null)
                    {
                        realPetEffectList.Add(abilityEffect);
                    }
                    else
                    {
                        Debug.LogError("SystemAbilityManager.SetupScriptableObjects(): Could not find ability effect : " + petEffectName + " while inititalizing " + DisplayName + ".  CHECK INSPECTOR");
                    }
                }
            }
        }
Esempio n. 7
0
        public override bool ProcessAbilityHit(Interactable target, int finalAmount, IAbilityCaster source, CombatMagnitude combatMagnitude, AbilityEffect abilityEffect, AbilityEffectContext abilityEffectContext, PowerResource powerResource)
        {
            //Debug.Log(DisplayName + ".HealEffect.ProcessAbilityHit(" + (target == null ? "null" : target.gameObject.name) + ", " + finalAmount + ", " + source.AbilityManager.UnitGameObject.name + ")");

            abilityEffectContext.powerResource = powerResource;
            bool returnValue = CharacterUnit.GetCharacterUnit(target).BaseCharacter.CharacterStats.RecoverResource(abilityEffectContext, powerResource, finalAmount, source, true, combatMagnitude);

            if (returnValue == false)
            {
                return(false);
            }

            return(base.ProcessAbilityHit(target, finalAmount, source, combatMagnitude, abilityEffect, abilityEffectContext, powerResource));
        }
Esempio n. 8
0
        /*
         *  public override void ClearAggro(GameObject target) {
         *      base.ClearAggro(target);
         *      aiController.ClearTarget();
         *  }
         */

        public override bool TakeDamage(AbilityEffectContext abilityEffectContext, PowerResource powerResource, int damage, IAbilityCaster source, CombatMagnitude combatMagnitude, AbilityEffect abilityEffect)
        {
            //Debug.Log("AICombat.TakeDamage(" + damage + ", " + sourcePosition + ", " + source + ")");
            if (!((baseCharacter.CharacterController as AIController).MyCurrentState is EvadeState) && !((baseCharacter.CharacterController as AIController).MyCurrentState is DeathState))
            {
                // order is important here.  we want to set target before taking damage because taking damage could kill us, and we don't want to re-trigger and agro on someone after we are dead

                // this should happen automatically inside the update loop of idle state
                //baseCharacter.MyCharacterController.SetTarget(source);
                return(base.TakeDamage(abilityEffectContext, powerResource, damage, source, combatMagnitude, abilityEffect));
            }
            return(false);
        }
Esempio n. 9
0
        public override bool ProcessAbilityHit(GameObject target, int finalAmount, IAbilityCaster source, CombatMagnitude combatMagnitude, AbilityEffect abilityEffect, AbilityEffectContext abilityEffectContext, PowerResource powerResource)
        {
            bool returnValue = target.GetComponent <CharacterUnit>().MyCharacter.CharacterCombat.TakeDamage(abilityEffectContext, powerResource, finalAmount, source, combatMagnitude, this);

            if (returnValue == false)
            {
                return(false);
            }

            return(base.ProcessAbilityHit(target, finalAmount, source, combatMagnitude, abilityEffect, abilityEffectContext, powerResource));
        }
Esempio n. 10
0
 public virtual GameObject ReturnTarget(AbilityEffect abilityEffect, GameObject target)
 {
     return(target);
 }
Esempio n. 11
0
 public virtual bool IsTargetInAbilityEffectRange(AbilityEffect abilityEffect, GameObject target, AbilityEffectContext abilityEffectContext = null)
 {
     // environmental effects only target things inside their collider, so everything is always in range
     return(true);
 }
Esempio n. 12
0
        public override bool TakeDamage(int damage, Vector3 sourcePosition, BaseCharacter source, CombatMagnitude combatMagnitude, AbilityEffect abilityEffect, bool reflectDamage = false)
        {
            //Debug.Log("PlayerCombat.TakeDamage(" + damage + ", " + source.name + ")");
            // enter combat first because if we die from this hit, we don't want to enter combat when dead
            EnterCombat(source);
            // added damageTaken bool to prevent blood effects from showing if you ran out of range of the attack while it was in progress
            bool damageTaken = base.TakeDamage(damage, sourcePosition, source, combatMagnitude, abilityEffect, reflectDamage = false);

            if (onHitEffect == null && SystemConfigurationManager.MyInstance.MyTakeDamageAbility != null && damageTaken)
            {
                MyBaseCharacter.MyCharacterAbilityManager.BeginAbility(SystemConfigurationManager.MyInstance.MyTakeDamageAbility, MyBaseCharacter.MyCharacterUnit.gameObject);
            }
            return(damageTaken);
        }
Esempio n. 13
0
        public override void ProcessAbilityHit(GameObject target, int finalAmount, IAbilityCaster source, CombatMagnitude combatMagnitude, AbilityEffect abilityEffect, AbilityEffectContext abilityEffectInput, PowerResource powerResource)
        {
            abilityEffectInput.powerResource = powerResource;
            target.GetComponent <CharacterUnit>().MyCharacter.CharacterStats.RecoverResource(abilityEffectInput, powerResource, finalAmount, source, true, combatMagnitude);

            base.ProcessAbilityHit(target, finalAmount, source, combatMagnitude, abilityEffect, abilityEffectInput, powerResource);
        }
Esempio n. 14
0
        public override bool TakeDamage(AbilityEffectContext abilityEffectContext, PowerResource powerResource, int damage, IAbilityCaster source, CombatMagnitude combatMagnitude, AbilityEffect abilityEffect, bool reflectDamage = false)
        {
            //Debug.Log("PlayerCombat.TakeDamage(" + damage + ", " + source.name + ")");
            // enter combat first because if we die from this hit, we don't want to enter combat when dead
            EnterCombat(source);
            // added damageTaken bool to prevent blood effects from showing if you ran out of range of the attack while it was in progress

            /*
             * bool damageTaken = base.TakeDamage(damage, sourcePosition, source, combatMagnitude, abilityEffect, reflectDamage = false);
             * return damageTaken;
             */
            return(base.TakeDamage(abilityEffectContext, powerResource, damage, source, combatMagnitude, abilityEffect, reflectDamage = false));
        }
Esempio n. 15
0
        public override bool ProcessAbilityHit(Interactable target, int finalAmount, IAbilityCaster source, CombatMagnitude combatMagnitude, AbilityEffect abilityEffect, AbilityEffectContext abilityEffectInput, PowerResource powerResource)
        {
            abilityEffectInput.powerResource = powerResource;
            bool returnValue = CharacterUnit.GetCharacterUnit(target).BaseCharacter.CharacterStats.RecoverResource(abilityEffectInput, powerResource, finalAmount, source, true, combatMagnitude);

            if (returnValue == false)
            {
                return(false);
            }

            return(base.ProcessAbilityHit(target, finalAmount, source, combatMagnitude, abilityEffect, abilityEffectInput, powerResource));
        }
Esempio n. 16
0
        public override void ProcessAbilityHit(GameObject target, int finalAmount, IAbilityCaster source, CombatMagnitude combatMagnitude, AbilityEffect abilityEffect, AbilityEffectContext abilityEffectInput, PowerResource powerResource)
        {
            target.GetComponent <CharacterUnit>().MyCharacter.CharacterCombat.TakeDamage(abilityEffectInput, powerResource, finalAmount, source, combatMagnitude, this, abilityEffectInput.reflectDamage);

            base.ProcessAbilityHit(target, finalAmount, source, combatMagnitude, abilityEffect, abilityEffectInput, powerResource);
        }