Ejemplo n.º 1
0
        /// <summary>
        /// Applies a specific modifier to this character
        /// </summary>
        /// <param name="mod"></param>
        public void ApplyModifier(CharacterStatsModifier mod)
        {
            // if the modifier is an instant effect then just apply it and return
            // we don't need to track what is happening to it
            if (mod.type == CharacterStatsModifier.Type.instant)
            {
                mod.OnActivate(gameObject);
                return;
            }


            var modInstance = (CharacterStatsModifier)ScriptableObject.CreateInstance(mod.GetType());

            modInstance.Copy(mod);
            Debug.Log(modInstance.duration);

            var inList = _modifiers.Find(x => x.GetType() == modInstance.GetType());

            if (inList == null)
            {
                modInstance.OnActivate(gameObject);
                _modifiers.Add(modInstance);
            }
            else
            {
                // refresh existing effect
                Debug.Log("EFFECT ALREADY PRESENT");

                inList.Refresh();
            }
        }
Ejemplo n.º 2
0
        public override void Copy(CharacterStatsModifier other)
        {
            base.Copy(other);
            var otherCast = (JumpModifier)other;

            modifiedJumpSpeed = otherCast.modifiedJumpSpeed;
        }
Ejemplo n.º 3
0
        public override void Copy(CharacterStatsModifier other)
        {
            base.Copy(other);

            var otherCast = (SpeedModifier)other;

            affectMaxVelocity   = otherCast.affectMaxVelocity;
            limtedMaxVelocity   = otherCast.limtedMaxVelocity;
            affectAcceleration  = otherCast.affectAcceleration;
            limitedAcceleration = otherCast.limitedAcceleration;
        }
Ejemplo n.º 4
0
 public virtual void Copy(CharacterStatsModifier other)
 {
     duration = other.duration;
     type     = other.type;
 }