public void Idle_State_Back_Command() { // Arrange var fakeState = State.Idle; var fakeSession = GetFakeSession(fakeState: fakeState); // Act var idleLogic = new IdleLogic(_logicTranslationsMock.Object); var result = idleLogic.Back(fakeSession); // Assert Assert.AreEqual(fakeSession.State, State.Idle); }
public async Task Idle_State_Incorrect_Command() { // Arrange var fakeState = State.Idle; var fakeSession = GetFakeSession(fakeState: fakeState); var fakeCommand = "command"; // Act var idleLogic = new IdleLogic(_logicTranslationsMock.Object); var result = await idleLogic.Act(fakeCommand, fakeSession); // Assert Assert.AreEqual(result.Session.State, State.Idle); }
public int GetPetState() { PetState petState = (PetState)this.GetComponent(typeof(PetState)); IdleLogic idleLogic = (IdleLogic)this.GetComponent(typeof(IdleLogic)); FollowLogic followLogic = (FollowLogic)this.GetComponent(typeof(FollowLogic)); WanderLogic wanderLogic = (WanderLogic)this.GetComponent(typeof(WanderLogic)); int result = this.indexAction; this.useTimer = true; if (this.calledByPlayer != 0) { float num = Vector3.Distance(this.get_transform().get_position(), this.owner.get_transform().get_position()); if (num <= this.ownerDist && RuntimeServices.ToBool(RuntimeServices.InvokeBinaryOperator("op_LessThan", RuntimeServices.GetProperty(RuntimeServices.GetProperty(this.owner.GetComponent(typeof(CharacterController)), "velocity"), "magnitude"), 1))) { result = 0; } else if (num > this.ownerDist) { result = 2; } this.useTimer = false; } else if (this.calledByPlayer == 0 && this.indexAction == 2) { result = Random.Range(0, 2); } else if (Time.get_time() - (float)this.stateStartTime > this.stateTimeOut) { int num2 = this.indexAction; if (num2 == 0) { result = 1; } else if (num2 == 1) { result = 0; } else { result = this.indexAction; } } return(result); }