bool GameScene::Start() { switch (m_initState) { case enInitState_Init00: light.SetAmbinetLight(CVector3::One); //カメラを初期化。 camera.SetPosition({ 0.0f, 0.0f, -700.0f }); camera.SetNear(400.0f); camera.SetFar(1000.0f); camera.Update(); AddGO(0, &cardDeck); textureBG = TextureResources().Load("Assets/sprite/BG.jpg"); spriteBG.Init(textureBG); spriteBG.SetSize({ 1280, 720 }); m_initState = enInitState_WaitInit; break; case enInitState_WaitInit: if (cardDeck.IsInited()) { return true; } break; } return false; }
bool OPvPCapturePoint::AddObject(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3) { if (ObjectGuid::LowType guid = sObjectMgr->AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3)) { AddGO(type, guid); return true; } return false; }
bool OPvPCapturePoint::AddObject(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3) { if(uint32 guid = objmgr.AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3)) { AddGO(type, guid, entry); return true; } return false; }
bool OPvPCapturePoint::AddObject(uint32 type, uint32 entry, uint32 mapId, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3) { GameObjectInfo const* goinfo = sObjectMgr.GetGameObjectInfo(entry); if (!goinfo) return 0; uint32 guid = sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT); GameObjectData& data = sObjectMgr.NewGOData(guid); data.id = entry; data.mapid = mapId; data.posX = x; data.posY = y; data.posZ = z; data.orientation = o; data.rotation0 = rotation0; data.rotation1 = rotation1; data.rotation2 = rotation2; data.rotation3 = rotation3; data.spawntimesecs = 0; data.animprogress = 100; data.spawnMask = 1; data.go_state = GO_STATE_READY; data.phaseMask = PHASEMASK_NORMAL; data.artKit = goinfo->type == GAMEOBJECT_TYPE_CAPTURE_POINT ? 21 : 0; data.dbData = false; Map * map = const_cast<Map*>(sMapMgr.CreateBaseMap(mapId)); if(!map) { sLog.outError("Map (Id: %i) for AddObject cannot be initialized.", mapId); return false; } //SetMap(newMap); sObjectMgr.AddGameobjectToGrid(guid, &data); // Spawn if necessary (loaded grids only) // We use spawn coords to spawn if(!map->Instanceable() && map->IsLoaded(x, y)) { GameObject *go = new GameObject; if (!go->LoadFromDB(guid, map)) { sLog.outError("AddGOData: cannot add gameobject entry %u to map", entry); delete go; return 0; } map->Add(go); } sLog.outDebug("AddGOData: dbguid %u entry %u map %u x %f y %f z %f o %f", guid, entry, mapId, x, y, z, o); //return guid; // if(uint32 guid = sObjectMgr.AddGOData(entry, map, x, y, z, o, 0, rotation0, rotation1, rotation2, rotation3)) if(guid) { AddGO(type, guid, entry); return true; } return false; }
void GameScene::Update() { switch (gameStep) { case enGameStep_DealCards: { //HandsOn-2 BGMの再生を開始するためにCSoundSourceのインスタンスを生成する。 bgmSource = NewGO<CSoundSource>(0); bgmSource->Init("Assets/sound/BGM.wav"); bgmSource->Play(true); //カードを配る。 int numPlayerNo = 0; while (true) { Card* card = cardDeck.GetUnuseCardRandom(); if (card == NULL) { //全部配り終わった。 break; } playerList[numPlayerNo].AddCard(card); numPlayerNo = (numPlayerNo + 1) % NUM_PLAYER; } for (int i = 0; i < NUM_PLAYER; i++) { AddGO(0, &playerList[i]); playerList[i].SetPlayerNo(i); } //カードの引く相手になるプレイヤーを設定。 playerList[0].SetTargetPlayer(&playerList[1]); playerList[1].SetTargetPlayer(&playerList[0]); g_fade->StartFadeIn(); gameStep = enGameStep_WaitFadeIn; }break; case enGameStep_WaitFadeIn: if (!g_fade->IsExecute()) { //まずはプレイヤーの手番。 playerList[0].ChangeState(Player::enStateSelectCard); gameStep = enGameStep_SelectPlayer; } break; case enGameStep_SelectPlayer: if (playerList[0].GetState() == Player::enStateIdle) { playerList[0].UpdateCardPosition(); playerList[1].UpdateCardPosition(); //プレイヤー選択終わり。 if (Judgement()) { //決着がついた。 gameStep = enGameStep_Over; } else { //COMの手番。 playerList[1].ChangeState(Player::enStateSelectCard); gameStep = enGameStep_SelectCom; } } break; case enGameStep_SelectCom: if (playerList[1].GetState() == Player::enStateIdle) { //COM選択終わり。 playerList[0].UpdateCardPosition(); playerList[1].UpdateCardPosition(); if (Judgement()) { //決着がついた。 gameStep = enGameStep_Over; } else { //プレイヤーの手番。 playerList[0].ChangeState(Player::enStateSelectCard); gameStep = enGameStep_SelectPlayer; } } break; case enGameStep_Over: MessageBox(NULL, "結果", "おわり", MB_OK); g_fade->StartFadeOut(); gameStep = enGameStep_WaitFadeOut; break; case enGameStep_WaitFadeOut: if (!g_fade->IsExecute()) { //タイトルに戻る。 DeleteGO(this); NewGO<TitleScene>(0); } break; } }