예제 #1
0
        protected override bool OnCollision(Body body)
        {
            PhysicalObject parent = (PhysicalObject)body.Parent;

            switch (parent.Type)
            {
            case PhysicalObjectType.Ship:
                if (body.GetType() == typeof(BaseShip))
                {
                    isAccelerating    = true;
                    MovementDirection = parent.Position - Position;
                    float distance = MovementDirection.Length();
                    if (distance <= lootDistance)
                    {
                        ((BaseShip)body.Parent).GainExperience(experience);
                        IsActive = false;
                        return(true);
                    }
                    MovementDirection /= distance;
                }
                break;
            }
            return(false);
        }