GameObject* GameObjectManager::CreateTott(const Ogre::Vector3& position, void* data){ CharControllerDef& def = *static_cast<CharControllerDef*>(data); GameObject* go = new GameObject(GAME_OBJECT_TOTT); AnimationComponent* acomp = new AnimationComponent; acomp->AddAnimationStates(1); go->AddComponent(acomp); go->AddUpdateable(acomp); CharacterController* contr = new CharacterController; go->AddComponent(contr); go->AddUpdateable(contr); go->AddLateUpdate(contr); acomp->Init("Yomi_2Yomi.mesh", m_scene_manager); contr->Init(position, acomp->GetEntity(), def.step_height, def.collider_type, m_physics_engine); contr->SetTurnSpeed(def.turn_speed); contr->SetVelocity(def.velocity); return go; }
GameObject* GameObjectManager::CreatePlayer(const Ogre::Vector3& position, void* data){ CharControllerDef& def = *static_cast<CharControllerDef*>(data); GameObject* go = new GameObject(GAME_OBJECT_PLAYER); AnimationComponent* acomp = new AnimationComponent; acomp->AddAnimationStates(2); go->AddComponent(acomp); go->AddUpdateable(acomp); CharacterController* contr = new CharacterController; go->AddComponent(contr); go->AddUpdateable(contr); go->AddLateUpdate(contr); FollowCameraComponent* fcc = new FollowCameraComponent; go->AddComponent(fcc); go->AddUpdateable(fcc); PlayerInputComponent* pccomp = new PlayerInputComponent; go->AddComponent(pccomp); go->AddUpdateable(pccomp); ChildSceneNodeComponent* csnc = new ChildSceneNodeComponent; go->AddComponent(csnc); Sound2DComponent* sound2D = new Sound2DComponent; go->AddComponent(sound2D); Sound3DComponent* sound3D = new Sound3DComponent; go->AddComponent(sound3D); Music2DComponent* music2D = new Music2DComponent; go->AddComponent(music2D); acomp->Init("Yomi_2Yomi.mesh", m_scene_manager); contr->Init(position, acomp->GetEntity(), def.step_height, def.collider_type, m_physics_engine); contr->SetTurnSpeed(def.turn_speed); contr->SetVelocity(def.velocity); contr->HasFollowCam(true); pccomp->Init(m_input_manager); sound2D->Init(m_sound_manager); sound3D->Init(m_sound_manager); music2D->Init(m_sound_manager); fcc->Init(m_scene_manager, m_viewport, true); fcc->GetCamera()->setNearClipDistance(0.1f); fcc->GetCamera()->setFarClipDistance(100); csnc->Init(Ogre::Vector3(0.0f, 0.0f, 1.0f), "CreateBubble", acomp->GetSceneNode()); return go; }