Пример #1
0
        private void OnPlayerCollision(object sender, Physic2DCollisionEventArgs args)
        {
            RigidBody2D other = args.Body2DA == RigidBody ? args.Body2DB : args.Body2DA;

            if (other.Owner.Tag == Game.TAG_EYE)
            {
                EyeController eye = other.Owner.FindComponent <EyeController>();
                if (eye.IsHot && !IsProtected)
                {
                    Die();
                }
                else if (eye.IsCool && !HasEye())
                {
                    AttachEye(other.Owner);
                    Animation.CurrentAnimation = Game.PLAYER_SHRINKING;
                    Animation.Play();
                    animationRemaining = AnimationTransition;
                    playerAnimState    = PlayerAnimationState.Shrinking;
                }
            }
            else if (args.PointA.HasValue && args.PointB.HasValue &&
                     args.PointA.Value.Y == args.PointB.Value.Y &&
                     args.PointA.Value.X != args.PointB.Value.X)
            {
                ;//this.soundManager.PlaySound(SoundType.Contact);
                collidingBodies.Add(other);
            }
        }
Пример #2
0
        private void OnEyeCollision(object sender, Physic2DCollisionEventArgs args)
        {
            RigidBody2D other = args.Body2DA == RigidBody ? args.Body2DB : args.Body2DA;

            if (other.Owner.Tag == Game.TAG_EYE)
            {
                EyeController eye = other.Owner.FindComponent <EyeController>();
                if (eye.IsHot && IsAttached)
                {
                    player.Die();
                }
            }
        }