Beispiel #1
0
int CUIMain::LoadWorld(void)
{
	Ogre::SceneNode* RootNode = mSceneMgr->getRootSceneNode();

	Ogre::Plane plane(Ogre::Vector3::UNIT_Y, -1); //1 unit under the ground
	Ogre::MeshManager::getSingleton().createPlane("ground", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,
		2000,2000,20,20,true,1,5,5,Ogre::Vector3::UNIT_Z);
	Ogre::Entity *GroundEnt = mSceneMgr->createEntity("GroundEntity", "ground");
	GroundEnt->setQueryFlags(QUERY_MASK_MOUSE_MOVEMENT);
	GroundEnt->setMaterialName("Rockwall");
	RootNode->createChildSceneNode()->attachObject(GroundEnt);

	CharacterInfo local_player_info;
	mWorld.LocalPlayer = new CLocalPlayer(mWorld, RootNode->createChildSceneNode());
	AttachMeshes(mWorld.LocalPlayer, local_player_info);
	mWorld.LocalPlayer->SetMoveSpeed(100);
	mWorld.LocalPlayer->SetState(State_Idle);

	//Test:
	CreateNewPlayer(0, CharacterInfo());

	Ogre::SceneNode *DestMarkerNode = RootNode->createChildSceneNode();
	Ogre::Entity *DestMarker = mSceneMgr->createEntity("Ent-DestMarker", "arrow.mesh");
	DestMarker->setQueryFlags(0);
	DestMarkerNode->attachObject(DestMarker);
	DestMarkerNode->setVisible(false);
	mWorld.LocalPlayer->SetDestinationMarker(DestMarkerNode, DestMarker);

	mMoveDestinationIndicator = RootNode->createChildSceneNode();
	Ogre::Entity* MouseIndicatorEntity = mSceneMgr->createEntity("Ent-MouseIndicator", "arrow.mesh");
	MouseIndicatorEntity->setQueryFlags(0);
	MouseIndicatorEntity->setMaterialName("ArrowTransparent");
	mMoveDestinationIndicator->attachObject(MouseIndicatorEntity);
	mMoveDestinationIndicator->scale(0.8, 0.8, 0.8);

	mEntityHoveringIndicator = RootNode->createChildSceneNode();
	mEntitySelectionIndicator = RootNode->createChildSceneNode();
	Ogre::Entity* HoverIndicatorEntity = mSceneMgr->createEntity("Ent-HoveringIndicator", "arrows.mesh");
	Ogre::Entity* SelectionIndicatorEntity = mSceneMgr->createEntity("Ent-SelectionIndicator", "arrows.mesh");
	HoverIndicatorEntity->setQueryFlags(0);
	SelectionIndicatorEntity->setQueryFlags(0);
	HoverIndicatorEntity->setMaterialName("ArrowTransparent");
	mEntitySelectionIndicator->setInheritOrientation(false);
	mEntityHoveringIndicator->attachObject(HoverIndicatorEntity);
	mEntitySelectionIndicator->attachObject(SelectionIndicatorEntity);
	mEntityHoveringIndicator->setVisible(false);
	mEntitySelectionIndicator->setVisible(false);

	return 1;
}
void Stage_001::NewPlayerEntry(int clientNo, CPoint position)
{
    if (0 > clientNo || MAX_MULTI_PLAYER < clientNo || 0 != m_pOtherPlayers[clientNo]) {
        return;
    }
    
    CBody *pPlayer = CreateNewPlayer(position);
    
    CView *pPlayerView = pPlayer->GetSurface();
    if (0 == clientNo) {
        pPlayerView->SetColor(CColor::GreenColor().SetAlpha(0.8f));
    }
    else {
        pPlayerView->SetColor(CColor::BlueColor().SetAlpha(0.8f));
    }
    
    pPlayerView->SetTransition(new CTransitionFadeIn(0.4f, this, Stage_001TransitionID_NewPlayerEntry));
    pPlayerView->RunTransition();
    
    m_pOtherPlayers[clientNo] = pPlayer;
}