Exemplo n.º 1
0
        public void ChangePlayerFacing(Direction direction, HeadFacing headFacing)
        {
            var msg = client.CreateMessage();

            msg.Write((byte)PacketType.LookTowards);
            msg.Write((byte)direction);
            msg.Write((byte)headFacing);

            client.SendMessage(msg, NetDeliveryMethod.ReliableOrdered);
        }
Exemplo n.º 2
0
        public void SetHeadFacing(HeadFacing facing)
        {
            if (CurrentMotion != SpriteMotion.Sit && CurrentMotion != SpriteMotion.Idle)
            {
                return;
            }

            HeadFacing   = facing;
            currentFrame = (int)HeadFacing;
            isDirty      = true;
        }
Exemplo n.º 3
0
 override public void SetHeadTurnTarget(Vector3 position, bool isInstant, HeadFacing _headFacing = HeadFacing.Manual)
 {
     if (_headFacing == HeadFacing.Hotspot && lockHotspotHeadTurning)
     {
         ClearHeadTurnTarget(HeadFacing.Hotspot, false);
     }
     else
     {
         base.SetHeadTurnTarget(position, isInstant, _headFacing);
     }
 }
Exemplo n.º 4
0
        public void ChangeMotion(SpriteMotion nextMotion, bool forceUpdate = false)
        {
            //Debug.Log($"{name} state {State} change motion from {CurrentMotion} to {nextMotion}");

            if (CurrentMotion == nextMotion && !forceUpdate)
            {
                return;
            }

            CurrentMotion = nextMotion;
            currentFrame  = 0;

            if (!isInitialized)
            {
                return;
            }

            var action = RoAnimationHelper.GetMotionIdForSprite(Type, nextMotion);

            if (action < 0 || action > SpriteData.Actions.Length)
            {
                action = 0;
            }
            ChangeAction(action);
            isPaused = false;
            isDirty  = true;

            if (Type == SpriteType.Player)
            {
                if (CurrentMotion == SpriteMotion.Idle || CurrentMotion == SpriteMotion.Sit)
                {
                    currentFrame = (int)HeadFacing;
                    UpdateSpriteFrame();
                    isPaused = true;
                }
                else
                {
                    HeadFacing = HeadFacing.Center;
                }
            }

            if (Shadow != null)
            {
                if (CurrentMotion == SpriteMotion.Sit || CurrentMotion == SpriteMotion.Dead)
                {
                    Shadow.SetActive(false);
                }
                else
                {
                    Shadow.SetActive(true);
                }
            }
        }
Exemplo n.º 5
0
 public void Reset()
 {
     Entity          = EcsEntity.Null;
     Target          = EcsEntity.Null;
     Character       = null;
     CombatEntity    = null;
     Connection      = null;
     CurrentCooldown = 0f;
     HeadId          = 0;
     HeadFacing      = HeadFacing.Center;
     IsMale          = true;
     QueueAttack     = false;
 }
Exemplo n.º 6
0
        public void ChangeLookDirection(ref EcsEntity entity, Direction direction, HeadFacing facing)
        {
            if (State == CharacterState.Moving || State == CharacterState.Dead)
            {
                return;
            }

            FacingDirection = direction;

            var player = entity.Get <Player>();

            if (player != null)
            {
                player.HeadFacing = facing;
            }

            Map.GatherPlayersForMultiCast(ref entity, this);
            CommandBuilder.ChangeFacingMulti(this);
            CommandBuilder.ClearRecipients();
        }
Exemplo n.º 7
0
 /**
  * <summary>Controls the head-facing position.</summary>
  * <param name = "_headTurnTarget">The Transform to face</param>
  * <param name = "_headTurnTargetOffset">The position offset of the Transform</param>
  * <param name = "isInstant">If True, the head will turn instantly</param>
  * <param name = "_headFacing">What the head should face (Manual, Hotspot, None)</param>
  */
 public override void SetHeadTurnTarget(Transform _headTurnTarget, Vector3 _headTurnTargetOffset, bool isInstant, HeadFacing _headFacing = HeadFacing.Manual)
 {
     if (_headFacing == HeadFacing.Hotspot && lockHotspotHeadTurning)
     {
         ClearHeadTurnTarget(false, HeadFacing.Hotspot);
     }
     else
     {
         base.SetHeadTurnTarget(_headTurnTarget, _headTurnTargetOffset, isInstant, _headFacing);
     }
 }
Exemplo n.º 8
0
 /**
  * <summary>Controls the head-facing position.</summary>
  * <param name = "position">The point in World Space to face</param>
  * <param name = "isInstant">If True, the head will turn instantly</param>
  * <param name = "_headFacing">What the head should face (Manual, Hotspot, None)</param>
  */
 public override void SetHeadTurnTarget(Vector3 position, bool isInstant, HeadFacing _headFacing = HeadFacing.Manual)
 {
     if (_headFacing == HeadFacing.Hotspot && lockHotspotHeadTurning)
     {
         ClearHeadTurnTarget (false, HeadFacing.Hotspot);
     }
     else
     {
         base.SetHeadTurnTarget (position, isInstant, _headFacing);
     }
 }
Exemplo n.º 9
0
        public virtual void SetHeadTurnTarget(Vector3 position, bool isInstant, HeadFacing _headFacing = HeadFacing.Manual)
        {
            if (_headFacing == HeadFacing.Hotspot && headFacing == HeadFacing.Manual)
            {
                // Don't look at Hotspots if manually-set
                return;
            }

            headTurnTarget = position;
            headFacing = _headFacing;

            if (isInstant)
            {
                CalculateHeadTurn ();
                SnapHeadMovement ();
            }
        }
Exemplo n.º 10
0
        public void ClearHeadTurnTarget(bool isInstant)
        {
            headFacing = HeadFacing.None;

            if (isInstant)
            {
                targetHeadAngles = Vector2.zero;
                SnapHeadMovement ();
            }
        }
Exemplo n.º 11
0
 public void ClearHeadTurnTarget(HeadFacing _headFacing, bool isInstant)
 {
     if (headFacing == _headFacing)
     {
         ClearHeadTurnTarget (isInstant);
     }
 }
Exemplo n.º 12
0
 private void OnLevelWasLoaded()
 {
     headFacing = HeadFacing.None;
     lockDirection = false;
     lockScale = false;
     isLipSyncing = false;
     lipSyncShapes.Clear ();
     ReleaseSorting ();
 }
Exemplo n.º 13
0
 /**
  * <summary>Controls the head-facing position.</summary>
  * <param name = "_headTurnTarget">The Transform to face</param>
  * <param name = "_headTurnTargetOffset">The position offset of the Transform</param>
  * <param name = "isInstant">If True, the head will turn instantly</param>
  * <param name = "_headFacing">What the head should face (Manual, Hotspot, None)</param>
  */
 public override void SetHeadTurnTarget(Transform _headTurnTarget, Vector3 _headTurnTargetOffset, bool isInstant, HeadFacing _headFacing = HeadFacing.Manual)
 {
     if (_headFacing == HeadFacing.Hotspot && lockHotspotHeadTurning)
     {
         ClearHeadTurnTarget (false, HeadFacing.Hotspot);
     }
     else
     {
         base.SetHeadTurnTarget (_headTurnTarget, _headTurnTargetOffset, isInstant, _headFacing);
     }
 }