/// <summary> /// This is called every frame by the AI script in order to tell the character what its inputs are /// </summary> public void SetInputs(ref BotCharacterInputs inputs) { if (IsStunned) { _moveInputVector = Vector3.zero; } else { _moveInputVector = inputs.MoveVector; _lookInputVector = inputs.LookVector; } }
public void OnSimulate(float deltaTime) { BotCharacterInputs inputs = new BotCharacterInputs(); float tickToTime = (float)GameStatics.GameManager.SimulationSystem.SimulationTick / (1f / Time.fixedDeltaTime); // Simulate an input on all controlled characters inputs.MoveVector = Mathf.Sin(tickToTime * MovementPeriod) * Vector3.forward; inputs.LookVector = Vector3.Slerp(-Vector3.forward, Vector3.forward, inputs.MoveVector.z).normalized; for (int i = 0; i < Characters.Length; i++) { Characters[i].SetInputs(ref inputs); } }