コード例 #1
0
        public override bool HandleCollision(ProjectileHead p, RaycastHit2D hit)
        {
            if (sfx.Length > 0)
            {
                audio.clip = sfx[Random.Range(0, sfx.Length)];
                audio.Play();
            }

            p.HandleDeflection(hit.normal);

            return(true);
        }
コード例 #2
0
        public override bool HandleCollision(ProjectileHead p, RaycastHit2D hit)
        {
            if (sfx.Length > 0)
            {
                audio.clip = sfx[Random.Range(0, sfx.Length)];
                audio.Play();
            }

            if (Time.time - lastMeleeStart <= meleeDuration)
            {
                // Parry! damage player as well
                p.HandleMelee(hit.normal, prefab);
            }
            else
            {
                // Normal deflect
                p.HandleDeflection(hit.normal);
            }

            return(true);
        }