www.pudn.com > Product_Submit2004.rar > Battery.cc, change:2004-10-12,size:1786b


#include "Battery.h" 
#include "../Common/Common.h" 
#include "../TOOLS/BallTricks.h" 
#include "../TOOLS/BasicTricks.h" 
#include "../TOOLS/HeadTricks.h" 
#include "../TOOLS/ComplexTricks.h" 
#include "../TOOLS/MovementTricks.h" 
 
// This guy jutters like an idiot to cause a battery overcurrent error :) 
Battery::Battery() { 
 
  debugOutput = configuration_.GetAsBool("DebugOutput"); 
 
  currentTrick = new BasicTricks::NullBody(); 
  headTrick = new BasicTricks::NullHead(); 
  inPlaying = false; 
  direction = 1; 
} 
 
Battery::~Battery() { 
  delete currentTrick; 
  delete headTrick; 
} 
 
void Battery::NewReadyModel() { 
  if (inPlaying) { 
    delete headTrick; 
    headTrick = new HeadTricks::HeadPan(85,-85,3,50);   // MQ 19/6 .. changed from (70,-70,0,12) 
 
    delete currentTrick; 
    currentTrick = new BasicTricks::NullBody(); 
    currentTrick->Start(); 
  } 
 
  int hC = headTrick->Continue(); 
  if (hC < 1) { 
    delete headTrick; 
    headTrick = new HeadTricks::HeadPan(85,-85,3,50);   // MQ 19/6 .. changed from (70,-70,0,12) 
    headTrick->Start(); 
  } 
  inPlaying = false; 
} 
 
void Battery::NewPlayingModel() { 
  if (!inPlaying) { 
    delete headTrick; 
    headTrick = new BasicTricks::NullHead(); 
    headTrick->Start(); 
 
    delete currentTrick; 
    currentTrick = new BasicTricks::NullBody(); 
    currentTrick->Start(); 
  } 
  inPlaying=true; 
 
  int hC = headTrick->Continue(); 
  if (hC < 1) { 
    delete headTrick; 
    headTrick = new BasicTricks::NullHead(); 
    headTrick->Start(); 
  } 
 
  delete currentTrick; 
  currentTrick = new BasicTricks::Step(LocomotionCommand::TP_WALK,200.0*direction,200.0*direction,30.0*direction,40.0*direction,1.8); 
  currentTrick->Start(); 
  currentTrick->Continue(); 
  direction*=-1; 
}