Ejemplo n.º 1
0
        public Vector2 GetRawVelocity()
        {
            LZFighterFrame     frame     = CurrentFrame;
            LZFighterStateData state     = CurrentStateData;
            StateMachineNode   stateNode = stateMachine.CurrentState;

            return(frame.velocity + state.velocity + stateNode.velocity);
        }
Ejemplo n.º 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;
 }
Ejemplo n.º 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));
        }
Ejemplo n.º 4
0
        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);
        }