Пример #1
0
//This function is called when the state needs to update itself
bool AttackMid::run(Player* p, double delta)
{
  //Update player timer
  p->incStateTime(delta);
  
  //Do some checks to see if this state is done executing
  if(p->getStateTime() >= duration)
  {
    //Register a hit on the other player
    Player* other = p->getOwner()->getOtherPlayer(p);
    bool success = other->getState()->hit(other, getStateID());
    
    //Either go to a staggered state or advance if success or not
    if(success)
    {
      std::cout << p->getName() << " succeeded in mid attack\n";
      p->forceChange(Advance::Instance()->getStateID());
      other->forceChange(Hit::Instance()->getStateID());
      return false;
    }
    else
    {
      p->forceChange(Stagger::Instance()->getStateID());
      if(other->changeState(Stagger::Instance()->getStateID()))
        return false;
    }
  }
  return true;
}
Пример #2
0
/*
 * update - triggers Status to update FPGA display variables based on current variables
 */
void StateMachine::update()
{
	StaticObj::status->updateDisplay(getStateID());
}