public void DisableBut(StepStates ss) { switch (ss) { case StepStates.uptop: Next.interactable = false; Previous.interactable = true; break; case StepStates.downdeep: Previous.interactable = false; Next.interactable = true; break; case StepStates.shoutup: Previous.interactable = false; Next.interactable = false; break; default: Previous.interactable = true; Next.interactable = true; break; } }
// Use this for initialization void Start() { anim = GetComponent <Animator> (); currentState = StepStates.standBy; maxWeightFootValue = maxOffset; minWeightFootValue = minOffset; InitializeArray(); }
//*** WALK SPEEED CONTROL *** void WalkSpeedControl(StepStates previousState, StepStates currentState) { //No Step if (previousState == StepStates.noStep && currentState != StepStates.noStep) { walkSpeed += (stepVelocitiReferenceValue - noStepDeltaTime) * instance.sensitivity; noStepDeltaTime = 0; return; } //MaxStep if (previousState == StepStates.maxStep && currentState != StepStates.maxStep) { walkSpeed += (stepVelocitiReferenceValue - maxStepDeltaTime) * instance.sensitivity; maxStepDeltaTime = 0; return; } //Step if (previousState == StepStates.step && currentState != StepStates.step) { walkSpeed += (stepVelocitiReferenceValue - stepDeltaTime) * instance.sensitivity; stepDeltaTime = 0; return; } //Jump if (previousState == StepStates.maxStep && currentState == StepStates.noStep) { UnityStandardAssets.Characters.FirstPerson.FirstPersonController fps = GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>(); if (fps != null) { fps.m_Jump = true; } } // //STOP // if (currentState == stepStates.stop) { // walkSpeed -= Time.fixedDeltaTime * gravityFactor; // return; // } }
private Vector2Int GetRandomPoint(PlayerBattleField field) { Vector2Int target = Vector2Int.zero; var space = field.GetFreeHorizontalSpace(); if (space.Count > 0) { var line = space[Random.Range(0, space.Count)]; target.x = line.list[Random.Range(0, line.list.Count)]; target.y = line.index; this.StepState = StepStates.Correct; } else { this.StepState = StepStates.Error; } return(target); }
int WalkSystem() { int[] magnitudes = new int[sensorCount]; //Getting magnitudes from stream reader dividing one matrix data at the vertical mid in 'sensorCount' magnitudes magnitudes[0] = spReader.GetValue(); // ** DEBUGS ** print("Current State: " + currentState.ToString()); //Inspector Debugs currentMagnitude = magnitudes[0]; currentSpeed = walkSpeed; //AutoOn STAND BY if (currentState == StepStates.standBy) { if (magnitudes [sensorCount - 1] > 0) { if (autoCalibrate) { currentState = StepStates.calibrating; } else { currentState = StepStates.step; } } else { return(0); } } //Auto Calibrating //TODO: guardar calibrado y que solo lo haga la 1ª vez if (currentState == StepStates.calibrating) { //We ignore first values if (ignoreCalibrationTime <= 0) { //Calibrado de mínimos if (magnitudes [sensorCount - 1] < minWeightFootValue) { minWeightFootValue = magnitudes [sensorCount - 1]; } //Calibrado de máximos if (magnitudes [sensorCount - 1] > maxWeightFootValue) { maxWeightFootValue = magnitudes [sensorCount - 1]; } calibrateTime -= Time.fixedDeltaTime; } else { ignoreCalibrationTime -= Time.fixedDeltaTime; } if (calibrateTime <= 0) { currentState = StepStates.step; //event!!! } else { return(0); } } //Step if (currentState == StepStates.step) { //To max step if (magnitudes [sensorCount - 1] < minWeightFootValue + minOffset) { currentState = StepStates.noStep; //event!!! return(0); } //To no step if (magnitudes [sensorCount - 1] > maxWeightFootValue - maxOffset) { currentState = StepStates.maxStep; //event!!! return(0); } } //No Step if (currentState == StepStates.noStep) { //To step if (magnitudes [sensorCount - 1] > minWeightFootValue + minOffset) { currentState = StepStates.step; return(0); } } //Max Step if (currentState == StepStates.maxStep) { //To step if (magnitudes [sensorCount - 1] < maxWeightFootValue - maxOffset) { currentState = StepStates.step; //event!!! return(0); } //To no step if (magnitudes [sensorCount - 1] < minWeightFootValue + minOffset) { currentState = StepStates.noStep; //event!!! return(0); } } if (currentState == StepStates.stop) { if (magnitudes [sensorCount - 1] > maxWeightFootValue - maxOffset) { WalkSpeedControl(currentState, currentState); currentState = StepStates.maxStep; return(0); } return(0); } //Long Step = slown down = stop if (noStepDeltaTime == maxStateTimeReferenceValue || maxStepDeltaTime == maxStateTimeReferenceValue || stepDeltaTime == maxStateTimeReferenceValue) { //currentState = stepStates.stop; //event!! return(0); } //Jump // if (ground && magnitudes [0] < minWeightFootValue && magnitudes [sensorCount-1] < minWeightFootValue ) { // ground = false; // anim.SetTrigger ("Jump"); // return true; // } /* //Landing * if (!ground && magnitudes [0] > 50 && magnitudes [sensorCount-1] > 50) { * ground = true; * } * * * //RigthDown * if (magnitudes [sensorCount-1] > maxWeightFootValue){ * anim.SetBool ("RigthUp", false); * //return true; * } * * //RigthUp * if (magnitudes [sensorCount-1] < minWeightFootValue){ * anim.SetBool ("RigthUp", true); * //return true; * } * * * * //LeftUp * if (magnitudes [0] < minWeightFootValue) { * anim.SetBool ("LeftUp", true); * //return true; * } * * //LeftDown * if (magnitudes [0] > maxWeightFootValue){ * anim.SetBool ("LeftUp", false); * //return true; * } * * * */ return(0); }
public EnemyStepLogic() { _targetShips = new List <Vector2Int>(); this.StepState = StepStates.First; }