Пример #1
0
        void Entering()
        {
            if (PlayerRef.Position.Y > PlayerRef.BoundLow + 10)
            {
                Mode  = CurrentMode.Waiting;
                State = CurrentState.Waving;
                return;
            }

            if (State == CurrentState.Waving)
            {
                SwitchToRunning();
            }

            if (Position.X > PlayerRef.Position.X)
            {
                PO.Velocity.X = -MaxSpeed;
            }
            else
            {
                PO.Velocity.X = MaxSpeed;
            }

            if (PO.CirclesIntersect(PlayerRef.PO))
            {
                if (PlayerRef.PickUpPerson())
                {
                    Enabled = false;
                }
                else
                {
                    Mode  = CurrentMode.Waiting;
                    State = CurrentState.Waving;
                }
            }
        }
Пример #2
0
        bool CheckPlayerClear()
        {
            foreach (Rock rock in m_Rocks)
            {
                if (rock.Active)
                {
                    if (m_PlayerClear.CirclesIntersect(rock.Position, rock.Radius))
                    {
                        return(false);
                    }
                }
            }

            if (m_UFO.Active)
            {
                if (m_PlayerClear.CirclesIntersect(m_UFO.Position, m_UFO.Radius))
                {
                    return(false);
                }
            }

            if (m_UFO.Shot.Active)
            {
                return(false);
            }

            if (m_Pod.Active)
            {
                if (m_PlayerClear.CirclesIntersect(m_Pod.Position, m_Pod.Radius))
                {
                    return(false);
                }
            }
            else
            {
                for (int pair = 0; pair < 3; pair++)
                {
                    if (m_Pod.PodPair[pair].Active)
                    {
                        if (m_PlayerClear.CirclesIntersect(m_Pod.PodPair[pair].Position, m_Pod.PodPair[pair].Radius))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        for (int pod = 0; pod < 2; pod++)
                        {
                            if (m_Pod.PodPair[pair].Pods[pod].Active)
                            {
                                if (m_PlayerClear.CirclesIntersect(m_Pod.PodPair[pair].Pods[pod].Position,
                                                                   m_Pod.PodPair[pair].Pods[pod].Radius))
                                {
                                    return(false);
                                }
                            }
                        }
                    }
                }
            }

            return(true);
        }