Ejemplo n.º 1
0
 public static void MoveState(AbstractFighter actor)
 {
     if (actor.CheckSmash("ForwardSmash"))
     {
         actor.doAction("Dash");
     }
     //float direction = actor.GetControllerAxis("Horizontal") * actor.facing;
     //shield
     if (actor.KeyBuffered("Attack"))
     {
         actor.doGroundAttack();
     }
     if (actor.KeyBuffered("Special"))
     {
         actor.doGroundSpecial();
     }
     if (actor.KeyBuffered("Jump"))
     {
         actor.doAction("Jump");
     }
     // else if (actor.DirectionHeld("Down"))
     //     actor.doAction("Crouch");
     else if (actor.GetAxis("Horizontal") == 0.0f)
     {
         actor.doAction("Stop");
     }
     if (actor.KeyBuffered(InputTypeUtil.GetBackward(actor.getBattleObject())))
     {
         actor.SendMessage("flip"); //TODO PIVOT
     }
     //Two other kinds of stop? Not sure if these are needed
 }
Ejemplo n.º 2
0
 public static void DashState(AbstractFighter actor)
 {
     /*
      * (key,invkey) = _actor.getForwardBackwardKeys()
      *  if _actor.keyHeld('attack'):
      *      if _actor.keysContain('shield'):
      *          _actor.doAction('DashGrab')
      *      elif _actor.checkSmash(key):
      *          print("Dash cancelled into forward smash")
      *          _actor.doAction('ForwardSmash')
      *      else:
      *          _actor.doAction('DashAttack')
      *  elif _actor.keyHeld('special'):
      *      _actor.doGroundSpecial()
      *  elif _actor.keysContain('down', 0.5):
      *      _actor.doAction('RunStop')
      *  elif not _actor.keysContain('left') and not _actor.keysContain('right') and not _actor.keysContain('down'):
      *      _actor.doAction('RunStop')
      *  elif _actor.preferred_xspeed < 0 and not _actor.keysContain('left',1) and _actor.keysContain('right',1):
      *      _actor.doAction('RunStop')
      *  elif _actor.preferred_xspeed > 0 and not _actor.keysContain('right',1) and _actor.keysContain('left',1):
      *      _actor.doAction('RunStop')
      */
     //float direction = actor.GetControllerAxis("Horizontal") * actor.facing;
     //shield
     if (actor.KeyBuffered("Attack"))
     {
         actor.doGroundAttack();
     }
     if (actor.KeyBuffered("Special"))
     {
         actor.doGroundSpecial();
     }
     if (actor.KeyBuffered("Jump"))
     {
         actor.doAction("Jump");
     }
     else if (actor.GetAxis("Horizontal") == 0.0f)
     {
         actor.doAction("Stop");
     }
     if (actor.KeyBuffered(InputTypeUtil.GetBackward(actor.getBattleObject())))
     {
         actor.SendMessage("flip"); //TODO PIVOT
     }
 }
Ejemplo n.º 3
0
    public Hitbox LoadHitbox(AbstractFighter owner, GameAction action, Dictionary <string, string> dict)
    {
        Hitbox hbox = Instantiate(hitbox_prefab);

        hbox.owner            = owner.getBattleObject();
        hbox.transform.parent = owner.transform;
        hbox.LoadValuesFromDict(dict);

        //Flip it if the fighter is flipped
        if (owner.GetIntVar(TussleConstants.FighterVariableNames.FACING_DIRECTION) == -1)
        {
            hbox.trajectory = 180 - hbox.trajectory;
        }
        LockHitbox(action, hbox);

        return(hbox);
    }
Ejemplo n.º 4
0
    public void FighterDies(AbstractFighter fighter, AbstractFighter killer)
    {
        int            fighterNum     = fighter.GetIntVar(TussleConstants.FighterVariableNames.PLAYER_NUM);
        FighterResults fighterResults = resultsDict[fighterNum];

        if (!BattleLoader.current_loader.stockInfinity)
        {
            fighterResults.stocks -= 1;
            if (fighterResults.stocks <= 0)
            {
                UnregisterObject(fighter.getBattleObject());
                //If there's one or less players left, end the battle
                if (fighters.Count <= 1)
                {
                    EndBattle();
                }
            }
            else
            {
                fighter.Respawn();
            }
        }
        fighterResults.falls += 1;
        fighterResults.score -= 1;

        //If the killer is null, it's a self destruct and we need to adjust the score as such
        if (killer == null)
        {
            fighterResults.score         -= 1;
            fighterResults.selfDestructs += 1;

            fighterResults.deathsAgainst[fighterNum] += 1;
            fighterResults.killsAgainst[fighterNum]  += 1;
        }
        else
        {
            int            killerNum     = killer.GetIntVar(TussleConstants.FighterVariableNames.PLAYER_NUM);
            FighterResults killerResults = resultsDict[killerNum];

            killerResults.score += 1;
            killerResults.killsAgainst[fighterNum]  += 1;
            fighterResults.deathsAgainst[killerNum] += 1;
        }
    }