public bool SetStepAction() //失敗するとfalse { if (SetAction(ACTION_PATTERN.STEP)) { return(true); } if (FailureAction(ACTION_PATTERN.STEP)) { if (!IsSwitch) { return(false); } //すでにそのタイミングでアクションが実行されていればfalse if (CurTyming == LastActionTyming) { return(false); } //すでにほかのアクションが入っていればfalse if (actionPattern != ACTION_PATTERN.NOACTION) { return(false); } actionPattern = ACTION_PATTERN.Failure; } return(false); }
// アクションを予約 private bool SetAction(ACTION_PATTERN action) { if (!CanSetAction(action)) { return(false); } if (!IsSwitch) { return(false); } //すでにそのタイミングでアクションが実行されていればfalse if (CurTyming == LastActionTyming) { return(false); } //すでにほかのアクションが入っていればfalse if (actionPattern != ACTION_PATTERN.NOACTION) { return(false); } actionPattern = action; return(true); }
public ACTION_PATTERN GetActionState() { ACTION_PATTERN ret = 0; ret = MasuInfo[0].ActionState; //代表して0のを参照する。←そういえばActionStateってMasuInfoに持たせる必要ないよね?? return(ret); }
private bool IsActiond(ACTION_PATTERN action) { return (actionPattern == action && Actiond && IsSwitch ); }
// Use this for initialization void Start () { actionPattern = ACTION_PATTERN.NOACTION; }
//bool FailureAction; bool FailureAction( ACTION_PATTERN pattern ) { return !( CurRestTime < CanTime[(int)pattern] ) && (CurRestTime < CanTime[(int)pattern] + FailureTime[(int)pattern]); }
//アクションを予約可能 //bool CanSetAction; bool CanSetAction(ACTION_PATTERN pattern) { return CurRestTime < CanTime[(int)pattern]; }
// Update is called once per frame void Update () { //現在のタイミングを取得 int Tyming = (int)(rhythmManager.FixedRhythm.Pos + 0.5f); //見ているタイミングが変化した場合 //アクションをリセット if (Tyming != CurTyming) { actionPattern = ACTION_PATTERN.NOACTION; SlowActionSet = false; } CurTyming = Tyming; CurRestTime = Mathf .Abs( rhythmManager .FixedRhythm .Time - ( CurTyming * rhythmManager .OnTempoTime ) ); //操作を受け付けるタイミングなのか //if (Mathf.Abs(rhythmManager.FixedRhythm.Time - (CurTyming * rhythmManager.OnTempoTime)) < CanTime) //{ // CanSetAction = true; // FailureAction = false; //} //else if (Mathf .Abs( rhythmManager .FixedRhythm .Time - ( CurTyming * rhythmManager .OnTempoTime ) ) < CanTime + FailureTime) //{ // CanSetAction = false; // FailureAction = true; //} //else //{ // CanSetAction = false; // FailureAction = false; //} //Actiondは1フレームしかtrueにできない Actiond = false; SlowActiond = false; //アクションが予約されているときは実行できるか確認 if (LastActionTyming != CurTyming && actionPattern != ACTION_PATTERN.NOACTION) { //タイミングを通過した後か bool IsTymingStay = (CurTyming <= rhythmManager.FixedRhythm.Pos); switch (actionPattern) { case ACTION_PATTERN.BLADE: //無条件で実行 Actiond = true; break; case ACTION_PATTERN.STEP: //タイミング通過後なら実行 if (IsTymingStay) { Actiond = true; } break; case ACTION_PATTERN.SLOW: //タイミング通過後なら実行 if (IsTymingStay) { Actiond = true; } break; case ACTION_PATTERN .Failure: //無条件で実行 Actiond = true; break; default: break; } if(Actiond) { LastActionTyming = CurTyming; } } if (SlowLastActionTyming != CurTyming && SlowActionSet) { bool IsTymingStay = ( CurTyming <= rhythmManager .FixedRhythm .Pos ); if (SlowLastActionTyming != CurTyming && SlowActionSet) { if(IsTymingStay) { SlowActiond = true; } } if (SlowActiond) { SlowLastActionTyming = CurTyming; } } }
public bool SetStepAction() //失敗するとfalse { if(SetAction(ACTION_PATTERN.STEP)) { return true; } if (FailureAction( ACTION_PATTERN .STEP )) { if (!IsSwitch) return false; //すでにそのタイミングでアクションが実行されていればfalse if (CurTyming == LastActionTyming) return false; //すでにほかのアクションが入っていればfalse if (actionPattern != ACTION_PATTERN .NOACTION) return false; actionPattern = ACTION_PATTERN .Failure; } return false; }
// アクションを予約 private bool SetAction(ACTION_PATTERN action) { if (!CanSetAction( action )) return false; if (!IsSwitch) return false; //すでにそのタイミングでアクションが実行されていればfalse if (CurTyming == LastActionTyming) return false; //すでにほかのアクションが入っていればfalse if (actionPattern != ACTION_PATTERN.NOACTION) return false; actionPattern = action; return true; }
private bool IsActiond(ACTION_PATTERN action) { return (actionPattern == action && Actiond && IsSwitch); }
// Use this for initialization void Start() { actionPattern = ACTION_PATTERN.NOACTION; }
//bool FailureAction; bool FailureAction(ACTION_PATTERN pattern) { return(!(CurRestTime < CanTime[(int)pattern]) && (CurRestTime < CanTime[(int)pattern] + FailureTime[(int)pattern])); }
//アクションを予約可能 //bool CanSetAction; bool CanSetAction(ACTION_PATTERN pattern) { return(CurRestTime < CanTime[(int)pattern]); }
// Update is called once per frame void Update() { //現在のタイミングを取得 int Tyming = (int)(rhythmManager.FixedRhythm.Pos + 0.5f); //見ているタイミングが変化した場合 //アクションをリセット if (Tyming != CurTyming) { actionPattern = ACTION_PATTERN.NOACTION; SlowActionSet = false; } CurTyming = Tyming; CurRestTime = Mathf.Abs(rhythmManager.FixedRhythm.Time - (CurTyming * rhythmManager.OnTempoTime)); //操作を受け付けるタイミングなのか //if (Mathf.Abs(rhythmManager.FixedRhythm.Time - (CurTyming * rhythmManager.OnTempoTime)) < CanTime) //{ // CanSetAction = true; // FailureAction = false; //} //else if (Mathf .Abs( rhythmManager .FixedRhythm .Time - ( CurTyming * rhythmManager .OnTempoTime ) ) < CanTime + FailureTime) //{ // CanSetAction = false; // FailureAction = true; //} //else //{ // CanSetAction = false; // FailureAction = false; //} //Actiondは1フレームしかtrueにできない Actiond = false; SlowActiond = false; //アクションが予約されているときは実行できるか確認 if (LastActionTyming != CurTyming && actionPattern != ACTION_PATTERN.NOACTION) { //タイミングを通過した後か bool IsTymingStay = (CurTyming <= rhythmManager.FixedRhythm.Pos); switch (actionPattern) { case ACTION_PATTERN.BLADE: //無条件で実行 Actiond = true; break; case ACTION_PATTERN.STEP: //タイミング通過後なら実行 if (IsTymingStay) { Actiond = true; } break; case ACTION_PATTERN.SLOW: //タイミング通過後なら実行 if (IsTymingStay) { Actiond = true; } break; case ACTION_PATTERN.Failure: //無条件で実行 Actiond = true; break; default: break; } if (Actiond) { LastActionTyming = CurTyming; } } if (SlowLastActionTyming != CurTyming && SlowActionSet) { bool IsTymingStay = (CurTyming <= rhythmManager.FixedRhythm.Pos); if (SlowLastActionTyming != CurTyming && SlowActionSet) { if (IsTymingStay) { SlowActiond = true; } } if (SlowActiond) { SlowLastActionTyming = CurTyming; } } }