/// <summary> /// 用来设定丢出指定的 什么文本 ... 在 什么文本框 ... 中. /// 提示:会更改onDoingStatus = xxx_On /// </summary> /// <param name="thingStr"></param> /// <param name="mbmM"></param> private void _StartShowThing(string thingStr, MsgBoxManager mbmM) { scriptState = ScriptState.OnDoing; if (mbmM == mbmNormal) { onDoingStatus = OnDoingStatus.Normal_On; } else if (mbmBg) { onDoingStatus = OnDoingStatus.Bg_On; } else { //add more box here } mbmM.RunWith(MsgBoxManager.MsgBoxStatus.Running, thingStr); }
void Start() { SetmbmAlphaTimeSet(mbmBg, mbmBg_Time); SetmbmAlphaTimeSet(mbmNormal, mbmNormal_Time); _setControlmode(false); _l2d_outerRadiusSet = l2dObj.pointLightOuterRadius; _l2d_IntensitySet = l2dObj.intensity; l2dObj.pointLightOuterRadius = 0f; l2dObj.intensity = 0f; lightStatus = LightStatus.Off; onDoingStatus = 0; cm.SetFollowingGameObject(camHold); cm.StartFollowing(); positionOrigion = mainCharacter.transform.position; _stopMoving(); characterManager.GenerateGroundEvent.AddListener(_GenNewGround); characterManager.DoorEventIn_OnWall.AddListener(_MakeDoor_OnWall_In); characterManager.DoorEventExit_OnWall.AddListener(_MakeDoor_OnWall_Exit); buttoners[(int)inputManager.InputManager.EnumStatus.Interact].ClickEvent.AddListener(_DoorMethod_OnWall_OnClick); characterManager.DoorEventOpenerIn.AddListener(_MakeDoor_In); characterManager.DoorEventOpenerExit.AddListener(_MakeDoor_Exit); characterManager.DoorEventLockerIn.AddListener(_DoorMethod_OnLockTrigger); buttoners[(int)inputManager.InputManager.EnumStatus.Interact].ClickEvent.AddListener(_DoorMethodOpener_OnClick); //----The First Word _StartShowThing(thingsToSay[thingsToSayPointer], mbmBg); }
// Update is called once per frame public void Update() { //---- if (!buttoners[(int)inputManager.InputManager.EnumStatus.Left].pressed && buttoners[(int)inputManager.InputManager.EnumStatus.Right].pressed) { _keeptMoving(true); } else { _stopMoving(); } //---- //----movement---- if (buttoners[(int)inputManager.InputManager.EnumStatus.Left].pressed && !buttoners[(int)inputManager.InputManager.EnumStatus.Right].pressed) { animator.SetInteger("State", 0); _keeptMoving(false);//left } else if (!buttoners[(int)inputManager.InputManager.EnumStatus.Left].pressed && buttoners[(int)inputManager.InputManager.EnumStatus.Right].pressed) { animator.SetInteger("State", 1); _keeptMoving(true);//right } else { animator.StopPlayback(); animator.SetInteger("State", -1); _stopMoving(); } //----End of movement---- switch (lightStatus) { case LightStatus.Off: break; case LightStatus.Off2On: _l2d_timer += Time.deltaTime; if (_l2d_timer > l2d_TimeSet) { _l2d_timer = 0f; lightStatus = LightStatus.On; } else { l2dObj.intensity = (_l2d_timer / l2d_TimeSet) * _l2d_IntensitySet; l2dObj.pointLightOuterRadius = (_l2d_timer / l2d_TimeSet) * _l2d_outerRadiusSet; } break; case LightStatus.On: break; case LightStatus.On2Off: _l2d_timer += Time.deltaTime; if (_l2d_timer > l2d_TimeSet) { _l2d_timer = 0f; lightStatus = LightStatus.Off; } else { l2dObj.intensity = ((l2d_TimeSet - _l2d_timer) / l2d_TimeSet) * _l2d_IntensitySet; l2dObj.pointLightOuterRadius = ((l2d_TimeSet - _l2d_timer) / l2d_TimeSet) * _l2d_outerRadiusSet; } break; default: break; } switch (scriptState) { case ScriptState.OnWaiting: if (!_isFirst) { _setControlmode(true); } break; case ScriptState.OnDoing: _setControlmode(false); switch (onDoingStatus) { case OnDoingStatus.Normal_On: //normal if (mbmNormal.StableFlag == true) { onDoingStatus = OnDoingStatus.Normal_Hold; } break; case OnDoingStatus.Normal_Hold: //等待mbmNormal加载完毕后 if (mbmNormal.Status == MsgBoxManager.MsgBoxStatus.Hidding && mbmNormal.StableFlag) { if (_isFirst) { lightStatus = LightStatus.Off2On; _setControlmode(true); _isFirst = false; scriptState = ScriptState.OnWaiting; break; } scriptState = ScriptState.OnWaiting; } break; case OnDoingStatus.Bg_On: //background if (mbmBg.StableFlag == true) { onDoingStatus = OnDoingStatus.Bg_Hold; } break; case OnDoingStatus.Bg_Hold: //等待mbmNormal加载完毕后 if (mbmBg.Status == MsgBoxManager.MsgBoxStatus.Hidding && mbmBg.StableFlag) { if (_isFirst) { thingsToSayPointer++; _StartShowThing("身边一片漆黑。^", mbmNormal); break; } scriptState = ScriptState.OnWaiting; } break; } break; default: break; } }