void Update()
 {
     if (Input.GetKeyDown(KeyCode.T))
     {
         //StatusEffect_Stunned.Create(gameObject, StunnedObj, 3f);
         StatusEffect_Knokback.Create(gameObject, Vector2.up, GM.testcur);
     }
 }
Beispiel #2
0
    private void CheckOverlap()
    {
        Collider2D[] overlaps = Physics2D.OverlapBoxAll(transform.position, size, 0f, layerMask);

        if (overlaps == null)
        {
            return;
        }

        for (int i = 0; i < overlaps.Length; i++)
        {
            Rigidbody2D rb2D = overlaps[i].GetComponent <Rigidbody2D>();

            var mob = overlaps[i].GetComponent <Mob_Base>();

            if (mob != null && rb2D != null)
            {
                //Destroy(mob.gameObject);
                mob.GetComponent <IDamage>().Hit(new AttackData(Damage));
                StatusEffect_Knokback.Create(mob.gameObject, Vector2.up, curve);
            }

            var corpse = overlaps[i].GetComponent <Corpse>();

            if (corpse != null && rb2D != null && !corpses.Contains(corpse))
            {
                rb2D.velocity    = new Vector2(0, speed - corpseFallSpeed);
                rb2D.isKinematic = true;
                corpses.Add(corpse);
                corpse.DestroyOfTime(3f, () => { corpses.Remove(corpse.GetComponent <Corpse>()); });
            }

            if (overlaps[i].CompareTag("Player"))
            {
                PlayerStatus.AddEffect(new PlayerStatus_Knockback(SE_ID, gameObject, KnockbackMode.Strong, true, Vector2.up, curve));
                dt += Time.fixedDeltaTime;
                if (dt > 0.1f)
                {
                    dt = 0;
                    PlayerStats.Inst.Damage(new AttackData(Damage));
                }
                return;
            }
        }
    }