コード例 #1
0
ファイル: LZFighter.cs プロジェクト: KangNansi/FightingGame
        public Vector2 GetRawVelocity()
        {
            LZFighterFrame     frame     = CurrentFrame;
            LZFighterStateData state     = CurrentStateData;
            StateMachineNode   stateNode = stateMachine.CurrentState;

            return(frame.velocity + state.velocity + stateNode.velocity);
        }
コード例 #2
0
 public LZFighterFrame(LZFighterFrame source)
 {
     foreach (HitBox hb in source.hitboxes)
     {
         hitboxes.Add(new HitBox(hb));
     }
     sprite   = source.sprite;
     time     = source.time;
     velocity = source.velocity;
 }
コード例 #3
0
        private void ApplyHitBox()
        {
            LZFighterFrame  frame = GetFrame();
            HitboxComponent hc    = fighter.gameObject.GetComponent <HitboxComponent>();

            if (hc == null)
            {
                Debug.LogWarning(fighter.name + ": No hitbox component found");
                return;
            }
            hc.SetDefense(frame.hitboxes.FindAll((h) => h._type == FightingGame.HitBox.Type.Body));
            hc.SetAttack(frame.hitboxes.FindAll((h) => h._type == FightingGame.HitBox.Type.Attack));
        }
コード例 #4
0
ファイル: LZFighter.cs プロジェクト: KangNansi/FightingGame
        public Vector2 GetVelocity()
        {
            LZFighterFrame     frame     = CurrentFrame;
            LZFighterStateData state     = CurrentStateData;
            StateMachineNode   stateNode = stateMachine.CurrentState;
            Vector2            velocity  = frame.velocity + state.velocity + stateNode.velocity;

            velocity *= internalVelocityStrength;

            if (velocityModifier != null)
            {
                foreach (var modifier in velocityModifier.GetInvocationList())
                {
                    velocity = (Vector2)modifier.DynamicInvoke(velocity);
                }
                //velocity /= velocityModifier.GetInvocationList().Length + 1f;
            }

            if (invertHorizontal)
            {
                velocity = new Vector2(-velocity.x, velocity.y);
            }
            return(velocity);
        }