示例#1
0
	//文字列の表示
	void Player::DrawStrings() {

		//文字列表示
		wstring Mess(L"Aでジャンプ、Xボタンで発射、Bでステージ切替\n");
		//オブジェクト数
		auto ObjCount = GetStage()->GetGameObjectVec().size();
		wstring OBJ_COUNT(L"OBJ_COUNT: ");
		OBJ_COUNT += Util::UintToWStr(ObjCount);
		OBJ_COUNT += L"\n";
		//物理オブジェクト数
		wstring PS_OBJ_COUNT(L"PS_OBJ_COUNT: ");
		PS_OBJ_COUNT += Util::UintToWStr(GetStage()->GetBasePhysics().GetNumBodies());
		PS_OBJ_COUNT += L"\n";
		auto fps = App::GetApp()->GetStepTimer().GetFramesPerSecond();
		wstring FPS(L"FPS: ");
		FPS += Util::UintToWStr(fps);
		FPS += L"\nElapsedTime: ";
		float ElapsedTime = App::GetApp()->GetElapsedTime();
		FPS += Util::FloatToWStr(ElapsedTime);
		FPS += L"\n";

		auto Pos = GetComponent<Transform>()->GetPosition();
		wstring PositionStr(L"Position:\t");
		PositionStr += L"X=" + Util::FloatToWStr(Pos.x, 6, Util::FloatModify::Fixed) + L",\t";
		PositionStr += L"Y=" + Util::FloatToWStr(Pos.y, 6, Util::FloatModify::Fixed) + L",\t";
		PositionStr += L"Z=" + Util::FloatToWStr(Pos.z, 6, Util::FloatModify::Fixed) + L"\n";

		wstring str = Mess + OBJ_COUNT + PS_OBJ_COUNT + FPS + PositionStr;
		//文字列をつける
		auto PtrString = GetComponent<StringSprite>();
		PtrString->SetText(str);
	}
示例#2
0
	//Xボタンハンドラ
	void Player::OnPushX() {
		auto XAPtr = App::GetApp()->GetXAudio2Manager();
		XAPtr->Start(L"cursor");

		auto Ptr = GetComponent<Transform>();
		Vec3 Pos = Ptr->GetPosition();
		Pos.y += 0.3f;
		Quat Qt = Ptr->GetQuaternion();
		Vec3 Rot = Qt.toRotVec();
		float RotY = Rot.y;
		Vec3 velo(sin(RotY), 0.05f, cos(RotY));
		velo.normalize();
		velo *= 20.0f;
		auto Group = GetStage()->GetSharedObjectGroup(L"ShellGroup");
		for (size_t i = 0; i < Group->size(); i++) {
			auto shptr = dynamic_pointer_cast<ShellSphere>(Group->at(i));
			if (shptr && !shptr->IsUpdateActive()) {
				//空きが見つかった
				shptr->Reset(Pos, velo);
				return;
			}
		}
		//ここまで来てれば空きがない
		GetStage()->AddGameObject<ShellSphere>(Pos, velo);
	}
示例#3
0
	//砲弾を発射する関数
	//ShellThrowMotion()から呼ばれる
	void RollingTorus::StartShellBall(){
		auto PlayerPtr = GetStage()->GetSharedGameObject<Player>(L"Player");
		auto PlayerPos = PlayerPtr->GetComponent<Transform>()->GetPosition();
		auto Pos = GetComponent<Transform>()->GetPosition();
		auto ShellAngle = PlayerPos - Pos;
		float len = ShellAngle.Length();
		ShellAngle.y = 0;
		ShellAngle.Normalize();
		ShellAngle *= len;
		//打ち上げの上向きの初速度を追加(値は固定)
		ShellAngle += Vector3(0.0f, 5.0f, 0);
		//グループ内に空きがあればそのオブジェクトを再利用
		//そうでなければ新規に作成
		auto Group = GetStage()->GetSharedObjectGroup(L"ShellBallGroup");
		auto ShellVec = Group->GetGroupVector();
		for (auto Ptr : ShellVec){
			//Ptrはweak_ptrなので有効性チェックが必要
			if (!Ptr.expired()){
				auto ShellPtr = dynamic_pointer_cast<ShellBall>(Ptr.lock());
				if (ShellPtr){
					if ((!ShellPtr->IsUpdateActive()) && (!ShellPtr->IsDrawActive())){
						ShellPtr->Refresh(Pos, ShellAngle, true);
						return;
					}
				}
			}
		}
		//ここまで来たら空きがなかったことになる
		//砲弾の追加
		auto Sh = GetStage()->AddGameObject<ShellBall>(Pos, ShellAngle, true);
		//グループに追加
		Group->IntoGroup(Sh);
	}
示例#4
0
	bool TestCellChangeEnemy::DefaultBehavior() {
		auto PtrRigid = GetComponent<Rigidbody>();
		auto Velo = PtrRigid->GetVelocity();
		Velo *= 0.95f;
		PtrRigid->SetVelocity(Velo);
		auto MapPtr = m_CelMap.lock();
		if (MapPtr) {
			auto PlayerPtr = GetStage()->GetSharedGameObject<Player>(L"Player");
			auto PlayerPos = PlayerPtr->GetComponent<Transform>()->GetPosition();
			CellIndex PlayerCell;
			if (MapPtr->FindCell(PlayerPos, PlayerCell)) {
				//プレイヤーがセルマップ上に入った。
				return false;
			}
			else {
				//プレイヤーはマップ上にいない
				//マップをプレイヤーの周りに再設定
				Vec3  CellmapStart;
				CellmapStart.x = float((int)(PlayerPos.x - 2.0f));
				CellmapStart.z = float((int)(PlayerPos.z - 2.0f));
				CellmapStart.y = 0.0f;
				MapPtr->RefleshCellMap(CellmapStart, 1.0f, 4, 4);
				auto GameStagePtr = dynamic_pointer_cast<GameStage>(GetStage());
				GameStagePtr->SetCellMapCost(L"CellMap2");
			}
		}
		return true;
	}
示例#5
0
    void GossipHello(Object * pObject, Player* Plr, bool AutoSend)
	{
		GossipMenu *Menu;

		if(GetStage(Plr) == STAGE_SERVERWIDE)
		{
			uint32 TextID = EPILORN_BASE_TEXT;
			objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), TextID, Plr);
			Menu->AddItem(0, "I would like to donate Badges of Justice.", 1);
			Menu->AddItem(0, "How many more Badges do you require?", 2);
		}
		if(GetStage(Plr) == STAGE_PERSONAL)
		{
			uint32 TextID = EPILORN_WELCOME_TEXT;
			objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), TextID, Plr);
			Menu->AddItem(0, "I would like to donate Badges of Justice", 1);
			Menu->AddItem(0, "How many more Badges do you require?", 3);
		}
		if(GetStage(Plr) == STAGE_READY)
		{
			uint32 TextID = EPILORN_READY_TEXT;
			objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), TextID, Plr);
			Menu->AddItem(1, "I would like to browse your goods.", 4);
		}
	
		if(AutoSend)
			Menu->SendTo(Plr);
	}
示例#6
0
	//初期化
	void SeekObject::OnCreate(){
		auto PtrTransform = AddComponent<Transform>();
		PtrTransform->SetPosition(m_StartPos);
		PtrTransform->SetScale(0.125f, 0.25f, 0.25f);
		PtrTransform->SetRotation(0.0f, 0.0f, 0.0f);
		//操舵系のコンポーネントをつける場合はRigidbodyをつける
		auto PtrRegid = AddComponent<Rigidbody>();
		//Seek操舵
		auto PtrSeek = AddComponent<SeekSteering>();
		//Arrive操舵
		auto PtrArrive = AddComponent<ArriveSteering>();
		//Arriveは無効にしておく
		PtrArrive->SetUpdateActive(false);

		//ObstacleAvoidance操舵
		auto PtrObstacleAvoidance = AddComponent<ObstacleAvoidanceSteering>();
		//Capsuleオブジェクトのグループを得る
		auto CapsuleGroup = GetStage()->GetSharedObjectGroup(L"CapsuleGroup");
		vector<SPHERE> SphereVec;
		for (size_t i = 0; i < CapsuleGroup->size(); i++){
			auto Obj = CapsuleGroup->at(i);
			auto PtrTrans = Obj->GetComponent<Transform>();
			SPHERE Sp;
			Sp.m_Center = PtrTrans->GetPosition();
			Sp.m_Center.y = 0.0f;
			Sp.m_Radius = 2.0f;
			SphereVec.push_back(Sp);
		}
		PtrObstacleAvoidance->SetObstacleSphereVec(SphereVec);


		//オブジェクトのグループを得る
		auto Group = GetStage()->GetSharedObjectGroup(L"ObjectGroup");
		//グループに自分自身を追加
		Group->IntoGroup(GetThis<SeekObject>());
		//分離行動をつける
		AddComponent<SeparationSteering>(Group);
		//Obbの衝突判定をつける
		auto PtrColl = AddComponent<CollisionObb>();

		//影をつける
		auto ShadowPtr = AddComponent<Shadowmap>();
		ShadowPtr->SetMeshResource(L"DEFAULT_CUBE");

		auto PtrDraw = AddComponent<PNTStaticDraw>();
		PtrDraw->SetMeshResource(L"DEFAULT_CUBE");
		PtrDraw->SetTextureResource(L"TRACE_TX");
		//透明処理をする
		SetAlphaActive(true);

		//ステートマシンの構築
		m_StateMachine = make_shared< StateMachine<SeekObject> >(GetThis<SeekObject>());
		//最初のステートをSeekFarStateに設定
		m_StateMachine->SetCurrentState(FarState::Instance());
		//初期化実行を行う
		m_StateMachine->GetCurrentState()->Enter(GetThis<SeekObject>());
	}
示例#7
0
	//初期化
	void Enemy3::OnCreate() {
		auto PtrTransform = GetComponent<Transform>();
		PtrTransform->SetPosition(m_StartPos);
		PtrTransform->SetScale(0.25f, 0.25f, 0.25f);
		PtrTransform->SetRotation(0.0f, 0.0f, 0.0f);
		//操舵系の行動をつける場合はRigidbodyをつける
		auto PtrRegid = AddComponent<Rigidbody>();

		//オブジェクトのグループを得る
		auto Group = GetStage()->GetSharedObjectGroup(L"EnemyGroup");
		//グループに自分自身を追加
		Group->IntoGroup(GetThis<GameObject>());
		//分離行動をつける
		auto PtrSep = GetBehavior<SeparationSteering>();
		PtrSep->SetGameObjectGroup(Group);

		auto PtrColl = AddComponent<CollisionSphere>();
		//横部分のみ反発
		PtrColl->SetIsHitAction(IsHitAction::Auto);

		//影をつける
		auto ShadowPtr = AddComponent<Shadowmap>();
		ShadowPtr->SetMeshResource(L"DEFAULT_SPHERE");

		//描画コンポーネントの設定
		auto PtrDraw = AddComponent<BcPNTStaticDraw>();
		//描画するメッシュを設定
		PtrDraw->SetMeshResource(L"DEFAULT_SPHERE");
		//描画するテクスチャを設定
		PtrDraw->SetTextureResource(L"WALL_TX");
		//ステートマシンの構築
		m_StateMachine.reset(new StateMachine<Enemy3>(GetThis<Enemy3>()));
		//最初のステートをEnemy3DefaultStateに設定
		m_StateMachine->ChangeState(Enemy3DefaultState::Instance());
	}
示例#8
0
	//初期化
	void AttackBall::OnCreate() {
		auto PtrTransform = GetComponent<Transform>();

		PtrTransform->SetScale(0.1f, 0.1f, 0.1f);
		PtrTransform->SetRotation(0, 0, 0);
		PtrTransform->SetPosition(0, 0, 0);

		//Rigidbodyをつける
		auto PtrRedid = AddComponent<Rigidbody>();


		//衝突判定をつける
		auto PtrCol = AddComponent<CollisionSphere>();

		//影をつける
		auto ShadowPtr = AddComponent<Shadowmap>();
		ShadowPtr->SetMeshResource(L"DEFAULT_SPHERE");

		auto PtrDraw = AddComponent<BcPNTStaticDraw>();
		PtrDraw->SetMeshResource(L"DEFAULT_SPHERE");

		auto Group = GetStage()->GetSharedObjectGroup(L"AttackBall");
		Group->IntoGroup(GetThis<AttackBall>());

		//最初は無効にしておく
		SetDrawActive(false);
		SetUpdateActive(false);

	}
示例#9
0
bool
UsdRelationship::_GetForwardedTargets(SdfPathSet* visited,
                                      SdfPathSet* uniqueTargets,
                                      SdfPathVector* targets,
                                      bool includeForwardingRels) const
{
    // Track recursive composition errors, starting with the first batch of
    // targets.
    SdfPathVector curTargets;
    bool success = GetTargets(&curTargets);

    // Process all targets at this relationship.
    for (SdfPath const &target: curTargets) {
        if (target.IsPrimPropertyPath()) {
            // Resolve forwarding if this target points at a relationship.
            if (UsdPrim prim = GetStage()->GetPrimAtPath(target.GetPrimPath())) {
                if (UsdRelationship rel =
                    prim.GetRelationship(target.GetNameToken())) {
                    if (visited->insert(rel.GetPath()).second) {
                        // Only do this rel if we've not yet seen it.
                        success &= rel._GetForwardedTargets(
                            visited, uniqueTargets, targets,
                            includeForwardingRels);
                    }
                    if (!includeForwardingRels)
                        continue;
                }
            }
        }            
        if (uniqueTargets->insert(target).second)
            targets->push_back(target);
    }

    return success;
}
示例#10
0
	//移動の向きを得る
	Vector3 Player::GetAngle(){
		Vector3 Angle(0, 0, 0);
		//コントローラの取得
		auto CntlVec = App::GetApp()->GetInputDevice().GetControlerVec();
		if (CntlVec[0].bConnected){
			if (CntlVec[0].fThumbLX != 0 && CntlVec[0].fThumbLY != 0){
				float MoveLength = 0;	//動いた時のスピード
				auto PtrTransform = GetComponent<Transform>();
				auto PtrCamera = GetStage()->GetCamera(0);
				//進行方向の向きを計算
				Vector3 Front = PtrTransform->GetPosition() - PtrCamera->GetEye();
				Front.y = 0;
				Front.Normalize();
				//進行方向向きからの角度を算出
				float FrontAngle = atan2(Front.z, Front.x);
				//コントローラの向き計算
				float MoveX = CntlVec[0].fThumbLX;
				float MoveZ = CntlVec[0].fThumbLY;
				//コントローラの向きから角度を計算
				float CntlAngle = atan2(-MoveX, MoveZ);
				//トータルの角度を算出
				float TotalAngle = FrontAngle + CntlAngle;
				//角度からベクトルを作成
				Angle = Vector3(cos(TotalAngle), 0, sin(TotalAngle));
				//正規化する
				Angle.Normalize();
				//Y軸は変化させない
				Angle.y = 0;
			}
		}
		return Angle;
	}
示例#11
0
	bool Enemy::SearchPlayer() {
		auto MapPtr = m_CelMap.lock();
		if (MapPtr) {
			auto PathPtr = GetComponent<PathSearch>();
			auto PlayerPtr = GetStage()->GetSharedGameObject<Player>(L"Player");
			auto PlayerPos = PlayerPtr->GetComponent<Transform>()->GetPosition();
			m_CellPath.clear();
			//パス検索をかける
			if (PathPtr->SearchCell(PlayerPos, m_CellPath)) {
				//検索が成功した
				m_CellIndex = 0;
				m_TargetCellIndex = m_CellPath.size() - 1;
				if (m_CellIndex == m_TargetCellIndex) {
					//すでに同じセルにいる
					m_NextCellIndex = m_CellIndex;
				}
				else {
					//離れている
					m_NextCellIndex = m_CellIndex + 1;

				}
				return true;
			}
			else {
				//失敗した
				m_CellIndex = -1;
				m_NextCellIndex = -1;
				m_TargetCellIndex = -1;
			}
		}
		return false;
	}
示例#12
0
文件: prim.cpp 项目: lvxejay/USD
PXR_NAMESPACE_OPEN_SCOPE

UsdPrim
UsdPrim::GetChild(const TfToken &name) const
{
    return GetStage()->GetPrimAtPath(GetPath().AppendChild(name));
}
示例#13
0
	//初期化
	void CapsuleObject::OnCreate(){
		auto PtrTransform = AddComponent<Transform>();
		PtrTransform->SetPosition(m_StartPos);
		PtrTransform->SetScale(2.0f, 2.0f, 2.0f);
		PtrTransform->SetRotation(0.0f, 0.0f, 0.0f);
		//操舵系のコンポーネントをつける場合はRigidbodyをつける
		auto PtrRegid = AddComponent<Rigidbody>();
		//Capsuleの衝突判定をつける
		auto CollPtr = AddComponent<CollisionCapsule>();
		CollPtr->SetFixed(true);
		//コリジョンのワイアフレーム表示
		AddComponent<PNTCollisionDraw>();

		//オブジェクトのグループを得る
		auto Group = GetStage()->GetSharedObjectGroup(L"CapsuleGroup");
		//グループに自分自身を追加
		Group->IntoGroup(GetThis<CapsuleObject>());


		//影をつける
		auto ShadowPtr = AddComponent<Shadowmap>();
		ShadowPtr->SetMeshResource(L"DEFAULT_CAPSULE");

		auto PtrDraw = AddComponent<PNTStaticDraw>();
		PtrDraw->SetMeshResource(L"DEFAULT_CAPSULE");
		PtrDraw->SetTextureResource(L"SKY_TX");

	}
示例#14
0
 void RoomBattle::GetClanBattleRankInfo(UInt8 type,Stream& st)
 {
     if( GetStage() != 2 )
         return;
     ClanBattleRoom* room = Battle::clanBattleRoomManager.GetBattleRoom(roomId);
     if( room == NULL )
         return;
     std::vector<GObject::Player*> vecPlayer = room->GetAllJoinPlayer();
     switch(type)
     {
         case 0:
             {
                 MoreKillFighters moreKillFighter;
                 std::sort(vecPlayer.begin(),vecPlayer.end(),moreKillFighter);
             }
             break;
         case 1:
             {
                 MoreKillSoldiers moreKillSoldiers;
                 std::sort(vecPlayer.begin(), vecPlayer.end(),moreKillSoldiers);
             }
             break;
         case 2:
             break;
         case 3:
             break;
         case 4:
             {
                 MoreConstantlyKill moreConstantlyKill;
                 std::sort(vecPlayer.begin(), vecPlayer.end(),moreConstantlyKill);
             }
             break;
         case 5:
             {
                 MoreEndConstantlyKill moreEndConstantlyKill;
                 std::sort(vecPlayer.begin(), vecPlayer.end(),moreEndConstantlyKill);
             }
             break;
     }
     UInt8 pos = 1; 
     UInt8 num = 0;
     size_t offset = st.size();
     st<<static_cast<UInt8>(num);
     for( auto it = vecPlayer.begin(); it != vecPlayer.end(); ++it )
     {
         if( pos <= 50 )
         {
             st<<(*it)->GetName();
             ++num;
         }
         else
         {
             break;
         }
         ++pos;
     }
     st.data<UInt8>(offset)=num;
 }
void PortHandle( void )
{
    EnSignalPolling();
    EnSignalTrigger();
    
    if ( GetStage() == STAGE_1 ){
        ClkSignalPolling();
        ClkSignalTrigger();
    }
}
示例#16
0
	//ユーティリティ関数群
	Vector3 SeekObject::GetPlayerPosition() const{
		//もしプレイヤーが初期化化されてない場合には、Vector3(0,m_BaseY,0)を返す
		Vector3 PlayerPos(0, m_BaseY, 0);
		auto PtrPlayer = GetStage()->GetSharedGameObject<Player>(L"Player", false);
		if (PtrPlayer){
			PlayerPos = PtrPlayer->GetComponent<Transform>()->GetPosition();
			PlayerPos.y = m_BaseY;
		}
		return PlayerPos;
	}
示例#17
0
	//初期化
	void SeekObject::OnCreate(){
		auto PtrTransform = AddComponent<Transform>();
		PtrTransform->SetPosition(m_StartPos);
		PtrTransform->SetScale(0.125f, 0.25f, 0.25f);
		PtrTransform->SetRotation(0.0f, 0.0f, 0.0f);
		//操舵系のコンポーネントをつける場合はRigidbodyをつける
		auto PtrRegid = AddComponent<Rigidbody>();

		//壁を作成(時計回りの3点で定義する面)
		vector<Plane> PlaneVec;
		PlaneVec.push_back(Plane(Vector3(0, 0, 20.0f), Vector3(0, 10.0f, 20.0f), Vector3(10.0f, 0, 20.0f)));
		PlaneVec.push_back(Plane(Vector3(-20.0f, 0, 0), Vector3(-20.0f, 10.0f, 0), Vector3(-20.0f, 0, 10.0f)));
		PlaneVec.push_back(Plane(Vector3(20.0f, 0, 0), Vector3(20.0f, 10.0f, 0), Vector3(20.0f, 0, -10.0f)));
		PlaneVec.push_back(Plane(Vector3(0, 0, -20.0f), Vector3(0, 10.0f, -20.0f), Vector3(-10.0f, 0, -20.0f)));
		//壁回避をつける
		auto WallAvoidancePtr = AddComponent<WallAvoidanceSteering>();
		WallAvoidancePtr->SetPlaneVec(PlaneVec);

		//Seek操舵
		auto PtrSeek = AddComponent<SeekSteering>();
		//Arrive操舵
		auto PtrArrive = AddComponent<ArriveSteering>();
		//Arriveは無効にしておく
		PtrArrive->SetUpdateActive(false);

		//オブジェクトのグループを得る
		auto Group = GetStage()->GetSharedObjectGroup(L"ObjectGroup");
		//グループに自分自身を追加
		Group->IntoGroup(GetThis<SeekObject>());
		//分離行動をつける
		AddComponent<SeparationSteering>(Group);
		//Obbの衝突判定をつける
		auto PtrColl = AddComponent<CollisionObb>();

		//影をつける
		auto ShadowPtr = AddComponent<Shadowmap>();
		ShadowPtr->SetMeshResource(L"DEFAULT_CUBE");

		auto PtrDraw = AddComponent<PNTStaticDraw>();
		PtrDraw->SetMeshResource(L"DEFAULT_CUBE");
		PtrDraw->SetTextureResource(L"TRACE_TX");
		//透明処理をする
		SetAlphaActive(true);

		//ステートマシンの構築
		m_StateMachine = make_shared< StateMachine<SeekObject> >(GetThis<SeekObject>());
		//最初のステートをSeekFarStateに設定
		m_StateMachine->SetCurrentState(FarState::Instance());
		//初期化実行を行う
		m_StateMachine->GetCurrentState()->Enter(GetThis<SeekObject>());
	}
示例#18
0
 GObject::Player* RoomBattle::GetMaxConstantlyKillPlayer()
 {
     if( GetStage() != 2 )
         return NULL;
     GObject::Player* player = NULL;
     ClanBattleRoom* room = Battle::clanBattleRoomManager.GetBattleRoom(roomId);
     if( room == NULL )
         return NULL;
     std::vector<GObject::Player*> vecPlayer = room->GetAllJoinPlayer();
     MoreConstantlyKill moreConstantlyKill;
     std::sort(vecPlayer.begin(),vecPlayer.end(),moreConstantlyKill);
     player = vecPlayer.front();
     return player;
 }
示例#19
0
	void ScoreObject::OnUpdate(){
		//文字列をつける
		auto PtrString = GetComponent<StringSprite>();
		wstring str(L"ポイント: ");
		str += Util::UintToWStr(m_Point);
		str += L"\n敵ポイント: ";
		str += Util::UintToWStr(m_EnemyPoint);
		auto Group = GetStage()->GetSharedObjectGroup(L"ShellBallGroup");
		auto ShellVec = Group->GetGroupVector();
		str += L"\n砲弾グループの砲弾数: ";
		str += Util::UintToWStr(ShellVec.size());

		PtrString->SetText(str);
	}
const MUID MMatchRuleAssassinate::ChooseCommander(int nTeam)
{
    MMatchStage* pStage = GetStage();
    if (pStage == NULL) return MUID(0,0);

    int nRedAliveCount, nBlueAliveCount, nChooseTeamCount;
    if (GetAliveCount(&nRedAliveCount, &nBlueAliveCount) == false) return MUID(0,0);
    if (nTeam == MMT_RED) {
        if (nRedAliveCount <= 0) return MUID(0,0);
        nChooseTeamCount = nRedAliveCount;
    }
    if (nTeam == MMT_BLUE) {
        if (nBlueAliveCount <= 0) return MUID(0,0);
        nChooseTeamCount = nBlueAliveCount;
    }


    if( m_bIsAdminCommander == true )
    {
        for(MUIDRefCache::iterator itor=pStage->GetObjBegin(); itor!=pStage->GetObjEnd(); itor++) {

            MMatchObject* pObj = (MMatchObject*)(*itor).second;

            if (pObj->GetEnterBattle() == false)
                continue;	// 배틀참가하고 있는 플레이어만 체크

            if (pObj->GetTeam() == nTeam && pObj->GetAccountInfo()->m_nUGrade == MMUG_ADMIN)
            {
                return pObj->GetUID();
            }
        }
    }


    MTime time;
    int nChoose = time.MakeNumber(1, nChooseTeamCount);

    int nCount = 0;
    for(MUIDRefCache::iterator itor=pStage->GetObjBegin(); itor!=pStage->GetObjEnd(); itor++) {
        MMatchObject* pObj = (MMatchObject*)(*itor).second;
        if (pObj->GetEnterBattle() == false) continue;	// 배틀참가하고 있는 플레이어만 체크
        if (pObj->GetTeam() == nTeam) {
            nCount++;
            if (nCount == nChoose) {
                return pObj->GetUID();
            }
        }
    }
    return MUID(0,0);
}
示例#21
0
	//初期化
	void Player::Create(){
		//初期位置などの設定
		auto Ptr = GetComponent<Transform>();
		Ptr->SetScale(0.25f, 0.25f, 0.25f);	//直径25センチの球体
		Ptr->SetRotation(0.0f, 0.0f, 0.0f);
		Ptr->SetPosition(0, 5.0f, 0);

		//Rigidbodyをつける
		auto PtrRedit = AddComponent<Rigidbody>();
		//重力をつける
		auto PtrGravity = AddComponent<Gravity>();
		//最下地点
		PtrGravity->SetBaseY(0.125f);
		//衝突判定をつける
		auto PtrCol = AddComponent<CollisionSphere>();

		//文字列をつける
		auto PtrString = AddComponent<StringSprite>();
		PtrString->SetText(L"");
		PtrString->SetTextRect(Rect2D<float>(16.0f, 16.0f, 640.0f, 480.0f));


		//影をつける(シャドウマップを描画する)
		auto ShadowPtr = AddComponent<Shadowmap>();
		//影の形(メッシュ)を設定
		ShadowPtr->SetMeshResource(L"DEFAULT_SPHERE");
		//描画コンポーネントの設定
		auto PtrDraw = AddComponent<BasicPNTDraw>();
		//描画するメッシュを設定
		PtrDraw->SetMeshResource(L"DEFAULT_SPHERE");
		//描画するテクスチャを設定
		PtrDraw->SetTextureResource(L"TRACE_TX");

		//透明処理
		SetAlphaActive(true);
		//0番目のビューのカメラを得る
		//LookAtCameraである
		auto PtrCamera = dynamic_pointer_cast<LookAtCamera>(GetStage()->GetCamera(0));
		if (PtrCamera){
			//LookAtCameraに注目するオブジェクト(プレイヤー)の設定
			PtrCamera->SetTargetObject(GetThis<GameObject>());
		}

		//ステートマシンの構築
		m_StateMachine = make_shared< StateMachine<Player> >(GetThis<Player>());
		//最初のステートをDefaultStateに設定
		m_StateMachine->SetCurrentState(DefaultState::Instance());
		//DefaultStateの初期化実行を行う
		m_StateMachine->GetCurrentState()->Enter(GetThis<Player>());
	}
示例#22
0
 UInt32 RoomBattle::GetTotalKillFighterNum(UInt8 forceId)
 {
     if( GetStage() != 2 )
         return 0;
     ClanBattleRoom* room = Battle::clanBattleRoomManager.GetBattleRoom(roomId);
     if( room == NULL )
         return 0;
     std::vector<GObject::Player*> vecPlayer = room->GetJoinAllies(forceId);
     UInt32 totalKill = 0;
     for( auto it = vecPlayer.begin(); it != vecPlayer.end(); ++it )
     {
         totalKill += (*it)->GetKillFighterNum();
     }
     return totalKill;
 }
示例#23
0
文件: USD_Proxy.cpp 项目: JT-a/USD
UsdPrim
GusdUSD_StageProxy::Accessor::GetPrimAtPath(const SdfPath& path,
                                            GusdUT_ErrorContext* err) const
{
    UT_ASSERT_P(_proxy);

    if(UsdPrim prim = GetStage()->GetPrimAtPath(path))
        return prim;
    if(err) {
        UT_WorkBuffer buf;
        buf.sprintf("Invalid prim <%s>", path.GetString().c_str());
        err->AddError(buf.buffer());
    }
    return UsdPrim();
}
示例#24
0
	//初期化
	void ShellBall::Create(){
		//Transformだけは追加しなくても取得できる
		auto Ptr = GetComponent<Transform>();
		Ptr->SetScale(m_NowScale);
		Ptr->SetRotation(0, 0, 0.0f);
		Ptr->SetPosition(m_StartPos);

		//衝突判定をつける
		auto PtrCollision = AddComponent<CollisionSphere>();
		//衝突は無効にしておく
		PtrCollision->SetUpdateActive(false);
		//砲弾のグループを得る
		auto Group = GetStage()->GetSharedObjectGroup(L"ShellBallGroup");
		//砲弾同士は衝突しないようにしておく
		PtrCollision->SetExcludeCollisionGroup(Group);


		//重力をつける
		auto PtrGravity = AddComponent<Gravity>();
		//最下地点
		PtrGravity->SetBaseY(0.125f);
		//ジャンプスタート
		PtrGravity->StartJump(m_JumpVec);

		//影の作成
		auto ShadowPtr = AddComponent<Shadowmap>();
		//影の形状
		ShadowPtr->SetMeshResource(L"DEFAULT_SPHERE");

		//描画コンポーネント
		auto PtrDraw = AddComponent<BasicPNTDraw>();
		//メッシュの登録
		PtrDraw->SetMeshResource(L"DEFAULT_SPHERE");
		if (m_IsEnemyBall){
			PtrDraw->SetDiffuse(Color4(1.0f, 1.0f, 0, 1.0f));
		}
		else{
			PtrDraw->SetDiffuse(Color4(0.0f, 1.0f, 0, 1.0f));
		}

		//ステートマシンの構築
		m_StateMachine = make_shared< StateMachine<ShellBall> >(GetThis<ShellBall>());
		//最初のステートをFiringStateに設定
		m_StateMachine->SetCurrentState(FiringState::Instance());
		//FiringStateの初期化実行を行う
		m_StateMachine->GetCurrentState()->Enter(GetThis<ShellBall>());

	}
示例#25
0
	//砲弾と衝突した瞬間の処理
	void RollingTorus::ShellHitMotion(){
		//衝突判定を得る
		auto PtrCollision = GetComponent<CollisionSphere>();
		//ヒットしたときのみこの関数は呼ばれるので
		//PtrCollision->GetHitObject()には必ず値が入っているが
		//一応、確認しておく
		if (PtrCollision->GetHitObject()){
			auto ShellPtr = dynamic_pointer_cast<ShellBall>(PtrCollision->GetHitObject());
			if (ShellPtr){
				//相手が砲弾だった
				//相手がプレイヤーの可能性があるので、チェックする
				//スコアオブジェクトにイベント送出
				auto PtrScoreObject = GetStage()->GetSharedGameObject<ScoreObject>(L"ScoreObject");
				PostEvent(0, GetThis<RollingTorus>(), PtrScoreObject, L"TorusHit");
			}
			//相手のTransformを得る。
			auto PtrOtherTrans = PtrCollision->GetHitObject()->GetComponent<Transform>();
			//相手の場所を得る
			auto OtherPos = PtrOtherTrans->GetPosition();

			//Transformを得る。
			auto PtrTrans = GetComponent<Transform>();
			//場所を得る
			auto Pos = PtrTrans->GetPosition();

			//飛ぶ方向を計算する
			Pos -= OtherPos;
			Pos.Normalize();
			Pos.y = 0;
			Pos *= 4.0f;
			Pos += Vector3(0, 4.0f, 0);

			//回転開始
			m_RotationSpeed = m_MaxRotationSpeed;
			//衝突を相手も含めなしにする
			PtrCollision->ClearBothHitObject();
			//衝突は無効にしておく
			PtrCollision->SetUpdateActive(false);

			//重力を得る
			auto PtrGravity = GetComponent<Gravity>();
			//ジャンプスタート
			PtrGravity->StartJump(Pos);

		}


	}
示例#26
0
	bool Enemy::DefaultBehavior() {
		auto PtrRigid = GetComponent<Rigidbody>();
		auto Velo = PtrRigid->GetVelocity();
		Velo *= 0.95f;
		PtrRigid->SetVelocity(Velo);
		auto MapPtr = m_CelMap.lock();
		if (MapPtr) {
			auto PlayerPtr = GetStage()->GetSharedGameObject<Player>(L"Player");
			auto PlayerPos = PlayerPtr->GetComponent<Transform>()->GetPosition();
			CellIndex PlayerCell;
			if (MapPtr->FindCell(PlayerPos, PlayerCell)) {
				return false;
			}
		}
		return true;
	}
示例#27
0
	bool Enemy::SeekBehavior() {
		auto PlayerPtr = GetStage()->GetSharedGameObject<Player>(L"Player");
		auto PlayerPos = PlayerPtr->GetComponent<Transform>()->GetPosition();
		auto MyPos = GetComponent<Transform>()->GetPosition();

		auto MapPtr = m_CelMap.lock();
		if (MapPtr) {
			if (SearchPlayer()) {
				auto PtrSeek = GetBehavior<SeekSteering>();
				if (m_NextCellIndex == 0) {
					auto PtrRigid = GetComponent<Rigidbody>();
					auto Velo = PtrRigid->GetVelocity();
					Velo *= 0.95f;
					PtrRigid->SetVelocity(Velo);
					PlayerPos.y = m_StartPosition.y;
					PtrSeek->Execute(PlayerPos);
				}
				else {
					if (length(MyPos - PlayerPos) <= 3.0f){
						auto PtrRigid = GetComponent<Rigidbody>();
						auto Velo = PtrRigid->GetVelocity();
						Velo *= 0.95f;
						PtrRigid->SetVelocity(Velo);
					}
					AABB ret;
					MapPtr->FindAABB(m_CellPath[m_NextCellIndex], ret);
					auto Pos = ret.GetCenter();
					Pos.y = m_StartPosition.y;
					PtrSeek->Execute(Pos);
				}
				return true;
			}
			else {
				auto PtrSeek = GetBehavior<SeekSteering>();
				CellIndex PlayerCell;
				if (MapPtr->FindCell(PlayerPos, PlayerCell)) {
					AABB ret;
					MapPtr->FindAABB(PlayerCell, ret);
					auto Pos = ret.GetCenter();
					Pos.y = m_StartPosition.y;
					PtrSeek->Execute(Pos);
					return true;
				}
			}
		}
		return false;
	}
示例#28
0
	//初期化
	void RollingTorus::Create(){
		//Transformだけは追加しなくても取得できる
		auto Ptr = GetComponent<Transform>();
		Ptr->SetScale(0.5f, 0.5f, 0.5f);
		Ptr->SetRotation(XM_PIDIV2, m_YRot, 0.0f);
		Ptr->SetPosition(m_StartPos);

		//衝突判定をつける
		auto PtrCollision = AddComponent<CollisionSphere>();

		//トーラスのグループを得る
		auto Group = GetStage()->GetSharedObjectGroup(L"RollingTorusGroup");
		//トーラス同士は衝突しないようにしておく
		PtrCollision->SetExcludeCollisionGroup(Group);


		//重力をつける
		auto PtrGravity = AddComponent<Gravity>();
		//最下地点
		PtrGravity->SetBaseY(0.25f);
		//ジャンプスタート
		PtrGravity->StartJump(Vector3(0,4.0f,0));

		//影の作成
		auto ShadowPtr = AddComponent<Shadowmap>();
		//影の形状
		ShadowPtr->SetMeshResource(L"DEFAULT_TORUS");

		//描画コンポーネント
		auto PtrDraw = AddComponent<BasicPNTDraw>();
		//メッシュの登録
		PtrDraw->SetMeshResource(L"DEFAULT_TORUS");

		PtrDraw->SetDiffuse(Color4(1.0f, 1.0f, 0, 1.0f));

		//ステートマシンの構築
		m_StateMachine = make_shared< StateMachine<RollingTorus> >(GetThis<RollingTorus>());
		//最初のステートをDefaultStateに設定
		m_StateMachine->SetCurrentState(TorusDefaultState::Instance());
		//DefaultStateの初期化実行を行う
		m_StateMachine->GetCurrentState()->Enter(GetThis<RollingTorus>());

	}
示例#29
0
 void RoomBattle::GetBattleResultInfo(UInt8 forceId,Stream& st)
 {
     if( GetStage() != 2 )
         return ;
     ClanBattleRoom* room = Battle::clanBattleRoomManager.GetBattleRoom(roomId);
     if( room == NULL )
         return ;
     Battle::RoomAllCityStatus* status = Battle::roomAllCityStatusManager.GetRoomAllCityStatus(roomId);
     st<<static_cast<UInt8>(status->GetCaptureCityNum());
     //st<<static_cast<UInt8>(GetCaptureCitys());
     std::vector<GObject::Player*> vecPlayer = room->GetAllJoinPlayer();
     st<<static_cast<UInt16>(vecPlayer.size());
     st<<static_cast<UInt16>(GetTotalKillFighterNum(forceId));
     st<<static_cast<UInt16>(GetTotalLostFighterNum(forceId));
     if( GetMaxConstantlyKillPlayer() != NULL )
     {
         st<<GetMaxConstantlyKillPlayer()->GetName();
     }
     else
     {
         st<<" 阳顶天";
     }
     GObject::Player* player = GetMaxTotalKillPlayer();
     if( player == NULL )
     {
         st<<"god is a girl";
     }
     else
     {
         st<<player->GetName();
     }
     st<<" 司马太郎";
     if( GetMaxEndConstantlyKillPlayer() != NULL )
     {
         st<<GetMaxEndConstantlyKillPlayer()->GetName();
     }
     else
     {
         st<<" my godness ";
     }
 }
示例#30
0
 void RoomBattle::CollectCaptureInfo(std::map<UInt8,UInt8>& force2captureCityNum)
 {
     if( GetStage() !=  2 )
         return;
     for(auto it = singleBattles.begin(); it != singleBattles.end(); ++it )
     {
         UInt8 captureId = (*it)->GetCaptureForce();
         if( captureId != 0 )
         {
             if( !force2captureCityNum[captureId] )
             {
                 force2captureCityNum[captureId] = 1;
             }
             else
             {
                 force2captureCityNum[captureId] += 1;
             }
         }
     }
      
 }