Example #1
0
        public override void CollidedWith(SKPhysicsBody other)
        {
            if (Health <= 0)
            {
                return;
            }

            if ((other.CategoryBitMask & (uint)ColliderType.Projectile) == 0)
            {
                return;
            }

            float damage = 10f;
            bool  killed = ApplyDamage(damage, other.Node);

            if (killed)
            {
                CharacterScene.AddToScoreAfterEnemyKill(25, other.Node);
            }
        }
        public override void CollidedWith(SKPhysicsBody other)
        {
            if (Dying)
            {
                return;
            }

            if ((other.CategoryBitMask & (uint)ColliderType.Projectile) != 0)
            {
                // Apply random damage of either 100% or 50%
                RequestedAnimation = AnimationState.GetHit;

                float damage = Random.Next(2) == 0 ? 50 : 100;
                bool  killed = ApplyDamage(damage, other.Node);

                if (killed)
                {
                    CharacterScene.AddToScoreAfterEnemyKill(10, other.Node);
                }
            }
        }
        public override void CollidedWith(SKPhysicsBody other)
        {
            if (Dying)
            {
                return;
            }

            if ((other.CategoryBitMask & (uint)ColliderType.Projectile) == 0)
            {
                return;
            }

            RequestedAnimation = AnimationState.GetHit;

            var  damage = 2f;
            bool killed = ApplyDamage(damage, other.Node);

            if (killed)
            {
                CharacterScene.AddToScoreAfterEnemyKill(100, other.Node);
            }
        }