Esempio n. 1
0
        public void BroadcastMovement(MoveToState moveToState)
        {
            var state = moveToState.RawMotionState;

            // update current style
            if ((state.Flags & RawMotionFlags.CurrentStyle) != 0)
            {
                // this lowercase stance field in Player doesn't really seem to be used anywhere
                stance = state.CurrentStyle;
            }

            // update CurrentMotionState here for substates?
            if ((state.Flags & RawMotionFlags.ForwardCommand) != 0)
            {
                if (((uint)state.ForwardCommand & (uint)CommandMask.SubState) != 0)
                {
                    CurrentMotionState.SetForwardCommand(state.ForwardCommand);
                }
            }
            else
            {
                CurrentMotionState.SetForwardCommand(MotionCommand.Ready);
            }

            if (state.CommandListLength > 0)
            {
                if (((uint)state.Commands[0].MotionCommand & (uint)CommandMask.SubState) != 0)
                {
                    CurrentMotionState.SetForwardCommand(state.Commands[0].MotionCommand);
                }
            }

            if (state.HasSoulEmote(false))
            {
                // prevent soul emote spam / bug where client sends multiples
                var soulEmote = state.Commands[0].MotionCommand;
                if (soulEmote == LastSoulEmote && DateTime.UtcNow < LastSoulEmoteEndTime)
                {
                    state.Commands.Clear();
                    state.CommandListLength = 0;
                }
                else
                {
                    var animLength = Physics.Animation.MotionTable.GetAnimationLength(MotionTableId, CurrentMotionState.Stance, soulEmote, state.Commands[0].Speed);

                    LastSoulEmote        = soulEmote;
                    LastSoulEmoteEndTime = DateTime.UtcNow + TimeSpan.FromSeconds(animLength);
                }
            }

            var movementData = new MovementData(this, moveToState);

            var movementEvent = new GameMessageUpdateMotion(this, movementData);

            EnqueueBroadcast(true, movementEvent);    // shouldn't need to go to originating player?

            // TODO: use real motion / animation system from physics
            //CurrentMotionCommand = movementData.Invalid.State.ForwardCommand;
            CurrentMovementData = movementData;
        }
Esempio n. 2
0
        //public DateTime LastSoulEmote;

        //private static TimeSpan SoulEmoteTime = TimeSpan.FromSeconds(2);

        public void BroadcastMovement(MoveToState moveToState)
        {
            var state = moveToState.RawMotionState;

            // update current style
            if ((state.Flags & RawMotionFlags.CurrentStyle) != 0)
            {
                // this lowercase stance field in Player doesn't really seem to be used anywhere
                stance = state.CurrentStyle;
            }

            // update CurrentMotionState here for substates?
            if ((state.Flags & RawMotionFlags.ForwardCommand) != 0)
            {
                if (((uint)state.ForwardCommand & (uint)CommandMask.SubState) != 0)
                {
                    CurrentMotionState.SetForwardCommand(state.ForwardCommand);
                }
            }
            else
            {
                CurrentMotionState.SetForwardCommand(MotionCommand.Ready);
            }

            if (state.CommandListLength > 0)
            {
                if (((uint)state.Commands[0].MotionCommand & (uint)CommandMask.SubState) != 0)
                {
                    CurrentMotionState.SetForwardCommand(state.Commands[0].MotionCommand);
                }
            }

            /*if (state.HasSoulEmote())
             * {
             *  // prevent soul emote spam / bug where client sends multiples
             *  var elapsed = DateTime.UtcNow - LastSoulEmote;
             *  if (elapsed < SoulEmoteTime) return;
             *
             *  LastSoulEmote = DateTime.UtcNow;
             * }*/

            var movementData = new MovementData(this, moveToState);

            var movementEvent = new GameMessageUpdateMotion(this, movementData);

            EnqueueBroadcast(false, movementEvent);    // shouldn't need to go to originating player?

            // TODO: use real motion / animation system from physics
            //CurrentMotionCommand = movementData.Invalid.State.ForwardCommand;
            CurrentMovementData = movementData;
        }
Esempio n. 3
0
        /// <summary>
        /// Ons the trigger enter.
        /// </summary>
        /// <param name="col">Col.</param>
        protected override void OnTriggerEnter(Collider col)
        {
            if (IsMovingBackAfterAttack && (col.tag == "stop1" || col.tag == "stop2"))
            {
                // StopPointへ移動中⇒移動終了
                CurrentMotionState.SetNext();
            }

            if (IsMovingForwardForAttack && col.tag == "enemy")
            {
                // 敵に向かって前進移動モーション停止
                // アタックモーション開始
                // 敵にダメージ
                // StopPointへ移動開始
                AttackTarget = col.gameObject.GetComponent <EnemyCharacter>();
                CurrentMotionState.SetNext();
            }

            base.OnTriggerEnter(col);
        }
Esempio n. 4
0
        public void BroadcastMovement(MoveToState moveToState)
        {
            var state = moveToState.RawMotionState;

            // update current style
            if ((state.Flags & RawMotionFlags.CurrentStyle) != 0)
            {
                // this lowercase stance field in Player doesn't really seem to be used anywhere
                stance = state.CurrentStyle;
            }

            // update CurrentMotionState here for substates?
            if ((state.Flags & RawMotionFlags.ForwardCommand) != 0)
            {
                if (((uint)state.ForwardCommand & (uint)CommandMask.SubState) != 0)
                {
                    CurrentMotionState.SetForwardCommand(state.ForwardCommand);
                }
            }
            else
            {
                CurrentMotionState.SetForwardCommand(MotionCommand.Ready);
            }

            if (state.CommandListLength > 0)
            {
                if (((uint)state.Commands[0].MotionCommand & (uint)CommandMask.SubState) != 0)
                {
                    CurrentMotionState.SetForwardCommand(state.Commands[0].MotionCommand);
                }
            }

            var movementData = new MovementData(this, moveToState);

            var movementEvent = new GameMessageUpdateMotion(this, movementData);

            EnqueueBroadcast(movementEvent);    // shouldn't need to go to originating player?

            // TODO: use real motion / animation system from physics
            CurrentMotionCommand = movementData.Invalid.State.ForwardCommand;
        }
Esempio n. 5
0
 protected override void Attacking()
 {
     CurrentMotionState.Execute();
 }