Exemple #1
0
    public void State_lowerdown_Update()
    {
        float dt = FrameController.DT();

        if (riseupTimer_ <= riseupTime_)
        {
            riseupTimer_ += dt;
            trans_.SetPositionY(MMath.Cerp(upperTrans_.position.y, lowerTrans_.position.y, riseupTimer_ / riseupTime_));
        }

        if (startupTimer_ <= shutdownTime_)
        {
            startupTimer_ += dt;
            revTime_       = MMath.Lerp(revFinalTime_, 50, startupTimer_ / shutdownTime_);
            revInc_        = 360.0f / revTime_;
        }

        if (riseupTimer_ > riseupTime_ && startupTimer_ > shutdownTime_)
        {
            smc.SetState(end);
        }

        //else if(riseupTimer_ >= riseupTime_ + transitionTime_)
        //	smc.SetState(riseup);
        trans_.RotateAround(0, 1, 0, revInc_ * dt);
    }
Exemple #2
0
    void State_Moving_Update()
    {
        timer += FrameController.DT();
        if (moveTime == 0)
        {
            Logger.Log("Elevator moveTime is 0, cannot use script.");
            return;
        }

        if (timer / moveTime > 0.5f)
        {
            if (TeleportToHub)
            {
                GameObject marker = GameObject.GetGameObjectByName("hubelevatorteleportmarker");
                float      distx  = marker.transform.position.x - gameObject.transform.position.x;
                float      distz  = marker.transform.position.z - gameObject.transform.position.z;
                player.transform.SetPositionX(player.transform.position.x + distx);
                player.transform.SetPositionZ(player.transform.position.z + distz);
                gameObject.transform.SetPosition(marker.transform.position);
                TeleportToHub = false;
            }
        }

        float y = MMath.Cerp(startY, endY, MMath.Clamp01(timer / moveTime));

        gameObject.transform.SetPositionY(y);
        player.transform.SetPositionY(y + 0.2f);
    }
Exemple #3
0
    public void State_Moving_Update()
    {
        //Logger.Log(moving.GetPercentageTime().ToString());
        timer += FrameController.DT();

        gameObject.transform.SetPositionY(MMath.Cerp(startY, endY, MMath.Clamp01(timer / 1.2f)));
    }
    public void OnUpdate()
    {
        timer += FrameController.DT();

        float rgb = MMath.Cerp(0.0f, 1.0f, MMath.Clamp01(timer / 3.0f));

        cr.GetMaterial().SetColor(new Color(rgb, rgb, rgb, 1.0f));
    }
    public static Vector3 CerpVector(Vector3 start, Vector3 end, float percent)
    {
        Vector3 result = new Vector3();

        result.X = MMath.Cerp(start.X, end.X, percent);
        result.Y = MMath.Cerp(start.Y, end.Y, percent);
        result.Z = MMath.Cerp(start.Z, end.Z, percent);
        return(result);
    }
Exemple #6
0
    void State_returning_Update()
    {
        timer += FrameController.DT();
        if (moveTime == 0)
        {
            Logger.Log("Elevator moveTime is 0, cannot use script.");
            return;
        }
        float y = MMath.Cerp(endY, startY, MMath.Clamp01(timer / moveTime));

        gameObject.transform.SetPositionY(y);
    }
Exemple #7
0
    public void State_riseup_Update()
    {
        float dt = FrameController.DT();

        riseupTimer_ += dt;

        if (riseupTimer_ <= riseupTime_)
        {
            trans_.SetPositionY(MMath.Cerp(lowerTrans_.position.y, upperTrans_.position.y, riseupTimer_ / riseupTime_));
        }
        else if (riseupTimer_ >= riseupTime_ + transitionTime_)
        {
            smc.SetState(lowerdown);
        }
        trans_.RotateAround(0, 1, 0, revInc_ * dt);
    }
Exemple #8
0
    public void State_startup_Update()
    {
        float dt = FrameController.DT();

        startupTimer_ += dt;

        if (startupTimer_ <= startupTime_)
        {
            revTime_ = MMath.Cerp(revInitTime_, revFinalTime_, startupTimer_ / startupTime_);
            revInc_  = 360.0f / revTime_;
        }
        else if (startupTimer_ >= startupTime_ + transitionTime_)
        {
            smc.SetState(riseup);
        }

        trans_.RotateAround(0, 1, 0, revInc_ * dt);
    }
Exemple #9
0
 public void S_Light_Update()
 {
     light.mIntensity = MMath.Cerp(mBeginInten, mTargetIntensity, smc.GetCurrentState().GetPercentageTime());
 }
Exemple #10
0
 void S_bindsmoveup_Update()
 {
     binds.transform.SetPositionY(MMath.Cerp(player.transform.position.y, player.transform.position.y - BINDSOFFSET, bindsmovedown.GetPercentageTime()));
 }