Beispiel #1
0
        /// <summary>
        /// Setups the passed <see cref="Mortar.Components.MovementComponent"/> to finishing the rotation and
        /// fires a <see cref="Mortar.Events.Incidents.RotationFinished"/> event.
        /// </summary>
        /// <param name="component">Component who finished rotation.</param>
        private void RotationFinished(MovementComponent component)
        {
            component.IsRotateing = false;

            // ToDo: Set SystemVariable CurrentScene
            //SystemVariables.RotatedEntity = name;

            RotationFinished incident = new RotationFinished();
            incident.EntityName = component.Name;
            QueueEvent(incident);
        }
Beispiel #2
0
 /// <summary>
 /// Proccesses rotation update of the passed <see cref="Mortar.Components.MovementComponent"/>.
 /// </summary>
 /// <param name="component">Component to rotate.</param>
 private void Rotate(MovementComponent component)
 {
     if(component.DistanceToDirection > component.RotationFinishedDistance)
     {
         component.Agent.Rotate(DeltaTime);
     }
     else
     {
         RotationFinished(component);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Setups the passed <see cref="Mortar.Components.MovementComponent"/> to finishing the movement and
        /// fires a <see cref="Mortar.Events.Incidents.DestinationReached"/> event.
        /// </summary>
        /// <param name="component">Component who finished moving.</param>
        private void DestinationReached(MovementComponent component)
        {
            component.IsMoving = false;
            //component.Agent.Stop();
            //component.Agent.ResetPath();
            //component.Agent = null;

            if(component.IsMovingTowardsEntity)
            {
                // ToDo: implement DestinationReached
            }
            else
            {

            }
        }
Beispiel #4
0
 /// <summary>
 /// Proccesses movement update of the passed <see cref="Mortar.Components.MovementComponent"/>.
 /// </summary>
 /// <param name="component">Component to move.</param>        
 private void Move(MovementComponent component)
 {
     if(component.DistanceToDestination > component.DestinationReachedDistance)
     {
         component.Agent.Move(DeltaTime);
     }
     else
     {
         DestinationReached(component);
     }
 }
Beispiel #5
0
 /// <summary>
 /// Creates a Unity implementation for <see cref="IMovementAgent"/>.
 /// </summary>
 /// <param name="navMeshAgent">Unity navMashAgent to wrap.</param>
 public UnityMovementAgent(MovementComponent component)
 {
     Component = component;
     navMeshAgent = component.Entity.GetComponent<NavMeshAgent>();
 }