Beispiel #1
0
std::list<Ogre::Vector2> WindManager::subdivideCurrent(Ogre::Vector2 origin, Ogre::Vector2 current)
{
	// The list for storing the subdivided vector
	std::list<Ogre::Vector2> subdivideList;

	Ogre::Vector2 subVector;

	// While the wind current vector is too long
	while(current.length() > this->mWorld->getWindMap()->getAlphaVector().length())
	{
		// Calculate the subvector to the size of the alpha vector
		subVector = current.normalisedCopy() * this->mWorld->getWindMap()->getAlphaVector().length();

		// Move the origin forward to the end of the next subvector
		origin += subVector;

		// Store the found subvector in the subdivision list
		subdivideList.push_back(origin);

		// Cut off the subVector
		current -= subVector;
	}

	// Add the final point of the wind current
	subdivideList.push_back(origin + current);

	// Return the subdivided wind current vector
	return subdivideList;
}
AIHall::AIHall(bool bIsAttacking, int type, int race, Ogre::Vector2 position, Ogre::Vector2 orientation)
{
    m_bIsAttacking = bIsAttacking;
    m_iType = type;
    m_vPos = position;
    m_iCollisionType = square;
    m_vPrevPos = m_vPos;
    m_vOri = orientation.normalisedCopy();
    m_dRadius = 80.0;

    MessageSystem::getSingletonPtr()->DispatchMessageToGraphFactory(this->ID(), factoryGraph, SMSG_AICreateGraphBuilding, position, m_vOri, type, race, Vector2(m_dActualHealth, m_dTotalHealth));

    m_pStateMachine = new AIStateSystem<AIHall>(this);
    m_pStateMachine->SetCurrentState(PeaceHall::Instance());

}