示例#1
0
文件: Player.cs 项目: TobieD/Glide
        void RandomWind(float delta)
        {
            var xmlPlayerData = XmlLoader.Load <PlayerSettings>("PlayerSettings");

            switch (m_WindState)
            {
            case WindState.NoWind:
                break;

            case WindState.BuildUp:
                if (m_CurrentWindForce < m_FinalWindForce)
                {
                    m_CurrentWindForce += m_CurrentIncrement;
                }
                else
                {
                    m_WindState = WindState.BuildOff;
                }

                break;

            case WindState.BuildOff:
                if (m_CurrentWindForce > m_MinHorizontalWind)
                {
                    m_CurrentWindForce -= m_CurrentIncrement;
                }
                else
                {
                    m_CurrentWindForce = m_MinHorizontalWind;
                    m_WindState        = WindState.NoWind;
                }
                break;
            }
        }
    public void Update()
    {
        windChangeTimer += Time.deltaTime;
        if (windChangeTimer >= TIME_TO_WIND_CHANGE)
        {
            windState          = GetNext(windState);
            windAnimationState = WindAnimationState.TRANSITIONING;
            windChangeTimer    = 0;

            targetWindSpeed        = GetNewSpeed();
            windTransitionVariable = (targetWindSpeed - windSpeed) / TIME_FOR_TRANSITION;
            testTimer = 0;
        }

        if (windAnimationState == WindAnimationState.TRANSITIONING)
        {
            windSpeed += windTransitionVariable * Time.deltaTime;
            testTimer += Time.deltaTime;
            if ((Mathf.Abs(windSpeed) >= Mathf.Abs(targetWindSpeed)))
            {
                windSpeed          = targetWindSpeed;
                windAnimationState = WindAnimationState.IDLE;
            }
        }
    }
示例#3
0
文件: Player.cs 项目: TobieD/Glide
        public void IncreaseWind()
        {
            Random rnd = new Random();

            m_FinalWindForce = (float)(rnd.NextDouble() * 25) + 250f; //gives a good wind boost
            m_WindState      = WindState.BuildUp;
        }
    WindState GetNext(WindState current)
    {
        var state = current;

        switch (current)
        {
        case WindState.CALM:
            state = WindState.LIGHT_AIR;
            break;

        case WindState.LIGHT_AIR:
            state = WindState.LIGHT_BREEZE;
            break;

        case WindState.LIGHT_BREEZE:
            state = WindState.GENTLE_BREEZE;
            break;

        case WindState.GENTLE_BREEZE:
            state = WindState.MODERATE_BREEZE;
            break;

        case WindState.MODERATE_BREEZE:
            state = WindState.FRESH_BREEZE;
            break;

        case WindState.FRESH_BREEZE:
            state = WindState.STRONG_BREEZE;
            break;

        case WindState.STRONG_BREEZE:
            state = WindState.HIGH_WIND;
            break;

        case WindState.HIGH_WIND:
            state = WindState.GALE;
            break;

        case WindState.GALE:
            state = WindState.STRONG_GALE;
            break;

        case WindState.STRONG_GALE:
            state = WindState.STORM;
            break;

        case WindState.STORM:
            state = WindState.VIOLENT_STORM;
            break;

        case WindState.VIOLENT_STORM:
            state = WindState.HURRICANE_FORCE;
            break;

        case WindState.HURRICANE_FORCE:
            break;
        }
        return(state);
    }
示例#5
0
        void RandomWind(float delta)
        {
            var xmlPlayerData = XmlLoader.Load <PlayerSettings>("PlayerSettings");

            switch (m_WindState)
            {
            case WindState.NoWind:
                m_WindTime += delta;
                if (m_WindTime >= m_WindTimePause)
                {
                    m_WindTime = 0f;
                    Random rnd = new Random();
                    if (xmlPlayerData.timeBetweenWindBursts == -1)
                    {
                        m_WindTimePause = rnd.Next(1, 15);
                    }
                    else
                    {
                        m_WindTimePause = xmlPlayerData.timeBetweenWindBursts;
                    }
                    m_WindState       = WindState.BuildUp; //initialise wind burst
                    m_FinalWindForce  = (float)(rnd.NextDouble() * 10.0);
                    m_WindDirection.X = (float)(rnd.Next(2)) - 1;
                    m_WindDirection.Y = 0f;
                }
                break;

            case WindState.BuildUp:
                if (m_CurrentWindForce < m_FinalWindForce)
                {
                    m_CurrentWindForce += m_CurrentIncrement;
                    // m_Rotation += m_TurnAmount;
                }
                else
                {
                    m_WindState = WindState.BuildOff;
                }

                break;

            case WindState.BuildOff:
                if (m_CurrentWindForce > 0.1f)     //0.1 so there's always some wind
                {
                    m_CurrentWindForce -= m_CurrentIncrement;
                }
                else
                {
                    m_CurrentWindForce = 0.1f;
                    m_WindState        = WindState.NoWind;
                }
                break;
            }
        }
示例#6
0
文件: Player.cs 项目: TobieD/Glide
        void RandomWind(float delta)
        {
            var xmlPlayerData = XmlLoader.Load<PlayerSettings>("PlayerSettings");
            switch (m_WindState)
            {
                case WindState.NoWind:
                    break;
                case WindState.BuildUp:
                    if (m_CurrentWindForce < m_FinalWindForce)
                    {
                        m_CurrentWindForce += m_CurrentIncrement;
                    }
                    else
                        m_WindState = WindState.BuildOff;

                    break;
                case WindState.BuildOff:
                    if (m_CurrentWindForce > m_MinHorizontalWind)
                        m_CurrentWindForce -= m_CurrentIncrement;
                    else
                    {
                        m_CurrentWindForce = m_MinHorizontalWind;
                        m_WindState = WindState.NoWind;
                    }
                    break;
            }
        }
示例#7
0
文件: Player.cs 项目: TobieD/Glide
 public void IncreaseWind()
 {
     Random rnd = new Random();
     m_FinalWindForce = (float)(rnd.NextDouble() * 25) + 250f; //gives a good wind boost
     m_WindState = WindState.BuildUp;
 }
示例#8
0
 /// <summary>
 /// 気流の状態を設定.
 /// </summary>
 /// <param name="state">State.</param>
 public void SetState(WindState state)
 {
     windState = state;
 }
 public WindVelocitySelector()
 {
     windState          = WindState.CALM;
     windAnimationState = WindAnimationState.IDLE;
     windSpeed          = GetNewSpeed();
 }
示例#10
0
文件: Player.cs 项目: TobieD/Glide
        void RandomWind(float delta)
        {
            var xmlPlayerData = XmlLoader.Load<PlayerSettings>("PlayerSettings");
            switch (m_WindState)
            {
                case WindState.NoWind:
                    m_WindTime += delta;
                    if (m_WindTime >= m_WindTimePause)
                    {
                        m_WindTime = 0f;
                        Random rnd = new Random();
                        if (xmlPlayerData.timeBetweenWindBursts == -1) m_WindTimePause = rnd.Next(1, 15);
                        else m_WindTimePause = xmlPlayerData.timeBetweenWindBursts;
                        m_WindState = WindState.BuildUp; //initialise wind burst
                        m_FinalWindForce = (float)(rnd.NextDouble() * 10.0);
                        m_WindDirection.X = (float)(rnd.Next(2)) - 1;
                        m_WindDirection.Y = 0f;
                    }
                    break;
                case WindState.BuildUp:
                    if (m_CurrentWindForce < m_FinalWindForce)
                    {
                        m_CurrentWindForce += m_CurrentIncrement;
                       // m_Rotation += m_TurnAmount;
                    }
                    else
                        m_WindState = WindState.BuildOff;

                    break;
                case WindState.BuildOff:
                    if (m_CurrentWindForce > 0.1f) //0.1 so there's always some wind
                        m_CurrentWindForce -= m_CurrentIncrement;
                    else
                    {
                        m_CurrentWindForce = 0.1f;
                        m_WindState = WindState.NoWind;
                    }
                    break;
            }
        }