コード例 #1
0
    public void OnStart()
    {
        _onTime            = 1.0f;
        _transitionOffTime = 0.1f;
        _transitionOnfTime = 0.2f;
        _minOffHoldTime    = 0.1f;
        _maxOffHoldTime    = 0.5f;
        _minOnHoldTime     = 0.1f;
        _maxOnHoldTime     = 0.5f;

        _minoffinten = 0.1f;
        _maxoffinten = 0.5f;
        _minonintern = 0.8f;
        _maxonintern = 1.1f;

        smc    = new StateMachineController();
        light  = gameObject.RequireComponent <CLight>();
        timer += MMath.GetRandomFloat() * 2.0f;

        lighthold = new State(smc, null, null, null, MinOnHoldTime, null);
        lighton   = new State(smc, S_LightOn_Start, S_Light_Update, null, TransitionOnTime, lighthold);
        lightoff  = new State(smc, S_LightOff_Start, S_Light_Update, null, TransitionOffTime, lighthold);
        smc.SetState(lightoff);

        mSound = gameObject.RequireComponent <CSound>();
    }
コード例 #2
0
    public Vector3 GetBoundsOnSphere()
    {
        float x = MMath.GetRandomFloat() * zone.width + zone.GetLeftBound();
        float y = MMath.GetRandomFloat() * zone.height + zone.GetBottomBound();
        float z = MMath.GetRandomFloat() * zone.depth + zone.GetFrontBound();

        x = MMath.Clamp(x, zone.GetLeftBound(), zone.GetRightBound());
        y = MMath.Clamp(y, zone.GetBottomBound(), zone.GetTopBound());
        z = MMath.Clamp(z, zone.GetFrontBound(), zone.GetBackBound());
        return(new Vector3(x, y, z));
    }