// power는 1이 최댓값.  0 = 0%, 1 = 100%.
    public static void Create(GameObject obj, float power, float time)
    {
        var SE_Obj = obj.GetComponent <StatusEffect_Object>();

        if (SE_Obj is null)
        {
            return;
        }

        SlowData d = new SlowData()
        {
            power = power, time = time, t = 0
        };

        power = Mathf.Min(power, 1f);
        StatusEffect_Slow slow = obj.GetComponent <StatusEffect_Slow>();

        if (slow.IsNull())
        {
            slow = obj.AddComponent <StatusEffect_Slow>();
        }
        slow.slows.Add(d);

        // 모든 옵션에 관한, 디폴트 우선 순위 설정, 높을수록 우선순위가 높음.
        slow.priority = 8;
        slow.pow      = power;
    }
示例#2
0
 public static void slowOnHit(Collider2D other, ref float damageAmount)
 {
     if (Random.value <= slowChance)
     {
         StatusEffect_Slow slowEffect = other.gameObject.GetComponent <StatusEffect_Slow>();
         if (slowEffect == null)
         {
             other.gameObject.AddComponent <StatusEffect_Slow> ();
         }
     }
 }
    public void AddEffect(int effectType, float duration, int value = -1)
    {
        StatusEffectType type = (StatusEffectType)effectType;

        for (int i = 0; i < activeEffects.Count; i++)
        {
            if (activeEffects[i].type == type)
            {
                activeEffects[i].Refresh();
                return;
            }
        }

        StatusEffect newEffect = null;

        switch (type)
        {
        case StatusEffectType.Bleed:

            newEffect = new StatusEffect_Bleed();
            break;

        case StatusEffectType.Slow:

            newEffect = new StatusEffect_Slow();
            break;

        case StatusEffectType.ArmorBreak:

            newEffect = new StatusEffect_ArmorBreak();
            break;

        case StatusEffectType.WeaponBreak:

            newEffect = new StatusEffect_WeaponBreak();
            break;

        case StatusEffectType.Poison:

            newEffect = new StatusEffect_Poison();
            break;
        }

        newEffect.Initialise(myEntity, duration, value);
        activeEffects.Add(newEffect);
        OnEffectStarted(type);
    }
 public void Create_Slow_nomal(GameObject o) => StatusEffect_Slow.CreateTest(o);