예제 #1
0
        private IEnumerator <IYieldInstruction> MoveMob()
        {
            yield return(new WaitForSeconds(0.1f));

            var position = GetBody().GetPosition().ToVector2();

            direction = MOVE_DIRECTION;

            while (true)
            {
                while (!isAttacking)
                {
                    position += new Vector2(direction, 0) * speed;

                    if (Math.Abs(position.X) > distance)
                    {
                        yield return(new WaitForSeconds(0.1f));

                        direction *= -1;
                    }

                    positionTransform.SetPosition(position);
                    directionTransform.SetDirection(direction < 0 ? Direction.Left : Direction.Right);
                    yield return(null);
                }

                yield return(new WaitForSeconds(SLEEP_TIME_AFTER_ATTACK));

                isAttacking = false;
            }
        }
예제 #2
0
 public EmptyParameters?Handle(MessageData <UpdatePositionRequestParameters> messageData, ref MessageSendOptions sendOptions)
 {
     positionTransform.SetPosition(new Vector2(messageData.Parameters.X, messageData.Parameters.Y));
     directionTransform.SetDirection((Direction)messageData.Parameters.Direction.FromDirections());
     return(null);
 }