// Have external be listening for events- depending on the string attached? void Awake() { mv = GetComponent <MovementType>(); hexQueuedMovement = GetComponent <HexQueuedCntrl>(); discreteMovement = GetComponent <DiscreteMovement>(); hexhexControl = GetComponent <HexToHexControl>(); disQueuedMovement = GetComponent <QueuedControl>(); turnControl = GetComponent <TurnBasedControl>(); simulatedControl = GetComponent <SimulatedControl>(); replayControl = GetComponent <ReplayControl>(); }
void Awake() { discreteQueued = GetComponent<QueuedControl>(); continousControl = GetComponent<ContinuousControl>(); hexesControl = GetComponent<HexToHexControl>(); discreteControl = GetComponent<DiscreteMovement>(); hexQueuedControl = GetComponent<HexQueuedCntrl>(); turnControl = GetComponent<TurnBasedControl>(); simulatedControl = GetComponent<SimulatedControl>(); replayControl = GetComponent<ReplayControl>(); }
protected override void OnUpdate() { float dt = Time.deltaTime; for (int i = 0; i < data.Length; i++) { PlayerInput input = data.Input[i]; Position position = data.Position[i]; Heading heading = data.Heading[i]; position.Value += input.Movement * dt * BombariaBootstrap.Settings.playerMovementSpeed; heading.Value = DiscreteMovement.GetHeadingXZDiscrete45(input.Movement); data.Heading[i] = heading; data.Position[i] = position; } }
public override void UpdateAction(AIStateController controller) { controller.SetFloat(TIMER_KEY, controller.getFloat(TIMER_KEY) + Time.deltaTime); if (controller.getFloat(TIMER_KEY) >= controller.getFloat(CUR_TIME_BEFORE_DIR_CHANGE_KEY)) { controller.SetFloat(STOP_TIMER_KEY, controller.getFloat(STOP_TIMER_KEY) + Time.deltaTime); if (controller.getFloat(STOP_TIMER_KEY) >= controller.getFloat(CUR_STOP_TIME_KEY)) { Resume(controller); } } else { DiscreteMovement.MoveDiscrete(controller.GetRigidbody(), GetCurMovingDirection(controller), speed); DiscreteMovement.RotateDiscrete(controller.GetRigidbody(), GetCurMovingDirection(controller)); } }
private void Rotate() { DiscreteMovement.RotateXZDiscrete45(rb, movement); }
public static void MoveDiscrete(Rigidbody rigidbody, DiscreteMovement.MovingDirection direction, float speed) { CommonUtils.Move(rigidbody, DiscreteMovement.GetDirectionVector(direction), speed); }
public static quaternion GetRotationXZDiscrete45(MovingDirection direction) { return(Quaternion.Euler(DiscreteMovement.GetRotationVector(direction))); }
public static float3 GetHeadingXZDiscrete45(float3 movement) { return(DiscreteMovement.GetRotationVector(GetMovingDirection(movement))); }