Beispiel #1
0
void HoverAction::OnCollide(Actor& other, CollisionParameter colpara){
	//もし丸が当たっていたら
	if (colpara.id == COL_ID::SPHERE_MODEL_NATURAL_COLL){
		ChangeAction(ACTION_ID::NORMAL_ACTION);
		//当たった場所へ移動
		player._Get()->SetPos(colpara.colPos);
		//Upをセット
		player._Get()->SetNor(colpara.colNormal);
	}
	else if (colpara.id == COL_ID::SPHERE_LINE_COLL&& !static_cast<Thread*>(&other)->IsShot()){
		if (static_cast<Thread*>(&other)->GetParameter().id == ACTOR_ID::PLAYER_THREAD_ACTOR && player._Get()->GetParameter().id == ACTOR_ID::PLAYER_ACTOR ||
			static_cast<Thread*>(&other)->GetParameter().id == ACTOR_ID::ENEMY_THREAD_ACTOR && player._Get()->GetParameter().id == ACTOR_ID::ENEMY_ACTOR){
			ChangeAction(ACTION_ID::THREAD_ACTION);
			player._Get()->SetThread(static_cast<Thread*>(&other)->shared_from_this());
		}
		//ChangeAction(ACTION_ID::THREAD_ACTION);
	}
	else if (colpara.id == COL_ID::TRIANGLE_SPHERE_COLL){
		if (static_cast<ThreadWeb*>(&other)->GetParameter().id == ACTOR_ID::PLAYER_THREADWEB_ACTOR && player._Get()->GetParameter().id == ACTOR_ID::PLAYER_ACTOR ||
			static_cast<ThreadWeb*>(&other)->GetParameter().id == ACTOR_ID::ENEMY_THREADWEB_ACTOR && player._Get()->GetParameter().id == ACTOR_ID::ENEMY_ACTOR){
			ChangeAction(ACTION_ID::THREAD_WEB_ACTION);
			player._Get()->SetThreadWeb(static_cast<ThreadWeb*>(&other)->shared_from_this());
		}
	}
}
Beispiel #2
0
void Sprite::Animate()
{
	if (obj_statu == STATU_dormant)
		return;

	if (++anim_counter>=anim_count_max)
	{	
		BitMapFrame++;
		if (spAnimations[animIndex][BitMapFrame] == -1)
		{
			switch (action)
			{
			case DIE:
				obj_statu = STATU_dormant;
				BitMapFrame =0;
				break;
			default:
				ChangeAction(STAND);
				BitMapFrame = 0;				
				break;
			}
			
		}
		
		if (action == WALK)
		{
			MovePos();
		}	
		
		anim_counter = 0;
 	}

}
Beispiel #3
0
void Sprite::Attack(int x, int y)
{
	if (x != pos_x || y != pos_y)
	{
		ChangeAction(ATTACK);
		ChangeDir(x, y);		
	}	
}
Beispiel #4
0
void Sprite::Move(int x, int y)
{
	if (x != pos_x || y != pos_y)
	{
		ChangeAction(WALK);
		ChangeDir(x, y);		
	}	
}
Beispiel #5
0
BOOL CObject_Bus::StartMove(const fVector3 *pTargetPos)
{
	if(pTargetPos == NULL)
	{
		return FALSE;
	}

	m_fvMoveTargetPos = *pTargetPos;
	m_fvSaveStartPos = GetPosition();

	m_fTargetDir = KLU_GetYAngle(fVector2(GetPosition().x, GetPosition().z), fVector2(m_fvMoveTargetPos.x, m_fvMoveTargetPos.z));
	if(m_fTargetDir < 0.f)
	{
		m_fTargetDir = __PI * 2.f + m_fTargetDir;
	}

	if(m_nCurrentAnimationIndex != BASE_ACTION_N_RUN)
	{
		ChangeAction(BASE_ACTION_N_RUN, 1.f, TRUE);
	}

	m_bMoving = TRUE;
	return TRUE;
}
Beispiel #6
0
void UserActions::Init()
{
	m_actionNames.clear();
	m_actionNames.push_back(_("none"));
	m_actionNames.push_back(_("highlight"));
	m_actionNames.push_back(_("notify login/out"));
	m_actionNames.push_back(_("ignore chat"));
	m_actionNames.push_back(_("ignore pm"));
	m_actionNames.push_back(_("autokick"));
	m_actionNames.push_back(_("notify hosted battle"));
	m_actionNames.push_back(_("notify status change"));

	m_configActionNames.clear();
	m_configActionNames.push_back(_T("none"));
	m_configActionNames.push_back(_T("highlight"));
	m_configActionNames.push_back(_T("notify_login"));
	m_configActionNames.push_back(_T("ignore_chat"));
	m_configActionNames.push_back(_T("ignore_pm"));
	m_configActionNames.push_back(_T("autokick"));
	m_configActionNames.push_back(_T("notify_hosted"));
	m_configActionNames.push_back(_T("notify_status"));

	m_actionTooltips.clear();
	m_actionTooltips.push_back(_("no action at all"));
	m_actionTooltips.push_back(_("highlight user in nick list and battles he participates in"));
	m_actionTooltips.push_back(_("popup a message box when user logs in/out from  the server"));
	m_actionTooltips.push_back(_("you won't see message by these users in normal channels"));
	m_actionTooltips.push_back(_("ignore private messages of these users, no pm window will open if any of these try to contact you privately"));
	m_actionTooltips.push_back(_("automatically kick users from battles hosted by yourself"));
	m_actionTooltips.push_back(_("popup a message box when user hosts a new battle"));
	m_actionTooltips.push_back(_("popup a message box when user changes away status"));

	// setup if empty
	if (!cfg().Exists(_T( "/Groups"))) {
		AddGroup(_("Default"));
		AddGroup(_("Ignore PM"));
		ChangeAction(_("Ignore PM"), UserActions::ActIgnorePM);
		AddGroup(_("Ignore chat"));
		ChangeAction(_("Ignore chat"), UserActions::ActIgnoreChat);
		AddGroup(_("Battle Autokick"));
		ChangeAction(_("Battle Autokick"), UserActions::ActAutokick);
		AddGroup(_("Friends"));
		ChangeAction(_("Friends"), UserActions::ActNotifBattle);
		ChangeAction(_("Friends"), UserActions::ActHighlight);
		ChangeAction(_("Friends"), UserActions::ActNotifLogin);
		// TODO select better color
		SetGroupColor(_("Friends"), wxColour(0, 0, 255));
	}


	// read
	m_groupNames = GetGroups();
	m_groupMap.clear();
	m_groupActions.clear();
	m_actionsGroups.clear();
	m_actionsPeople.clear();
	m_knownUsers.Clear();
	for (unsigned int i = 0; i < m_groupNames.GetCount(); ++i) {
		wxString name = m_groupNames[i];
		m_groupMap[name] = GetPeopleList(name);
		for (unsigned int k = 0; k < m_groupMap[name].GetCount(); ++k) {
			wxString user = m_groupMap[name][k];
			m_knownUsers.Add(user);
			m_peopleGroup[user] = name;
		}
		m_groupActions[name] = GetGroupActions(name);
	}
	for (size_t i = 0; i < m_actionNames.size(); ++i) {
		UserActions::ActionType cur = (UserActions::ActionType)(1 << i);
		wxArrayString tmp;
		for (unsigned int j = 0; j < m_groupNames.GetCount(); ++j) {
			wxString name = m_groupNames[j];
			if ((m_groupActions[name] & cur) != 0) {
				tmp.Add(name);
				for (unsigned int k = 0; k < m_groupMap[name].GetCount(); ++k) {
					m_actionsPeople[cur].Add((m_groupMap[name])[k]);
				}
			}
		}
		tmp.Sort();
		m_actionsGroups[cur] = tmp;
	}
	m_actionsGroups[ActNone] = m_groupNames;
	m_groupNames.Sort();
	m_knownUsers.Sort();
}
Beispiel #7
0
void FirstAI::AIRun(float frameTime)
{
	//視界内に目標がいるか調べる
	target.isLooking = Search();

	//目標を発見するまではクリスタルを攻撃or索敵
	if (!target.isBattle)
	{
		if (targetCrystal)
		{
			//ターゲットをクリスタルに
			target.lastLookingPos = nearestCrystalPos;
			target.lastLookingVec = RCVector3::normalize(nearestCrystalPos - myPos);
			target.distance = nearestCrystalDist;
			//CrystalPointMoveAttack(frameTime);
			ChangeAction(AI_ACTION::CrystalPointMoveAttack);
		}
		//すべてのクリスタルが制圧されていたら
		else if (!target.isLooking)
		{
			//とりあえず相手の陣地のクリスタルを目指す
			if (parameter.id == ACTOR_ID::PLAYER_ACTOR){
				target.lastLookingPos = iceCrystalPos;
				target.lastLookingVec = RCVector3::normalize(iceCrystalPos - myPos);
				target.distance = iceCrystalDist;
			}
			else{
				target.lastLookingPos = caveCrystalPos;
				target.lastLookingVec = RCVector3::normalize(caveCrystalPos - myPos);
				target.distance = caveCrystalDist;
			}
			ChangeAction(AI_ACTION::CrystalPointMoveAttack);
			//aiTimer += frameTime;
			//if (aiTimer < 8.0f)
			//	ChangeAction(AI_ACTION::RandomMove);
			//else if (aiTimer < 11.0f)
			//	ChangeAction(AI_ACTION::CreateThreadWeb);
			//else if (aiTimer < 14.0f)
			//	ChangeAction(AI_ACTION::JumpShotRewind);
			//else
			//{
			//	ChangeAction(AI_ACTION::RandomMove);
			//	aiTimer = 0.0f;
			//}
		}

		//敵を発見した場合
		if (target.isLooking)
		{
			//距離がクリスタルより近い場合
			if (targetDists[targetNum % 4] < nearestCrystalDist)
			{
				//戦闘状態へ移行
				target.isBattle = true;
				aiTimer = 0.0f;
			}
		}
	}

	//戦闘状態の場合
	if (target.isBattle)
	{
		//視界内に捉えているなら
		if (target.isLooking)
		{
			//最後に捉えた地点を更新
			target.lastLookingPos = target.pos - RCVector3::normalize(RCMatrix4::getUp(target.mat)) * 0.2f;
			//方向も取得
			target.lastLookingVec = RCVector3::normalize(target.lastLookingPos - myPos);
			lostTimer = 0;
		}
		//捉えていないなら
		else
		{
			//見失った時間に加算
			lostTimer += frameTime;
			//レベルに応じて貫通して見える
			if (lostTimer <= level[levelNum].penetrationTime){
				target.lastLookingPos = target.pos;
				target.lastLookingVec = RCVector3::normalize(target.lastLookingPos - myPos);
			}
		}

		if (lostTimer <= 4.0f)
		{
			//距離が近い場合
			if (target.distance <= level[levelNum].rewindLength)
				//糸発射しながら移動
				ChangeAction(AI_ACTION::TargetPointMoveAttack);
			//距離が遠い場合
			else
				//巻き取って接近
				ChangeAction(AI_ACTION::TargetJumpShotRewind);
		}
	}

	//見失ってから数秒経過したら
	if (lostTimer > 4.0f)
	{
		target.isBattle = false;
		//if (lostTimer  < 12.0f)
		//	//見失った地点に向かって移動
		//	ChangeAction(AI_ACTION::TargetPointMove);

		//else
		//{
		//	//移動し終えたら旋回して索敵
		//	aiTimer += frameTime;
		//	if (aiTimer < 6.0f)
		//		//索敵のために回転
		//		ChangeAction(AI_ACTION::TurnLook);
		//	//TurnLook(frameTime);
		//	else if (aiTimer >= 6.0f)
		//	{
		//		//回転しても見つからなかった場合は戦闘状態解除
		//		target.isBattle = false;
		//		lostTimer = 0;
		//		aiTimer = 0;
		//	}
		//}
	}

	actionFunc[currentAction](frameTime);
}
Beispiel #8
0
void Sprite::Die(int x, int y)
{
	ChangeAction(DIE);
}
void PlayerAction::Control(){
	ride = false;
	if (player._Get()->ReturnPlayerNum() == 0 && (thisAction == ACTION_ID::NORMAL_ACTION || (thisAction == ACTION_ID::THREAD_ACTION && !hitGround) || (thisAction == ACTION_ID::THREAD_WEB_ACTION && !hitGround))){
		Vector3 playerPos = RCMatrix4::getPosition(player._Get()->GetParameter().matrix);
		Vector3 cameraVec = RCVector3::normalize(Device::GetInstance().GetCamera(cID)->CameraParam()->Target - Device::GetInstance().GetCamera(cID)->CameraParam()->Eye);
		std::weak_ptr<Thread> threadWeak;
		std::weak_ptr<ThreadWeb> threadWebWeak;
		float lowAngle = 360;
		float webLengh = 10000;
		for (auto i : threadWebVec){
			threadWebWeak = i;
		}
		if (threadWebWeak._Get() != nullptr){
			threadWebWeak._Get()->SetSelectThreadWeb();

			if (Device::GetInstance().GetInput()->KeyDown(INPUTKEY::KEY_SPACE, true) || Device::GetInstance().GetInput()->GamePadButtonDown(padNum, GAMEPADKEY::BUTTON_R3, true)){
				if ((threadWebWeak._Get()->GetParameter().id == ACTOR_ID::PLAYER_THREADWEB_ACTOR && player._Get()->GetParameter().id == ACTOR_ID::PLAYER_ACTOR) ||
					(threadWebWeak._Get()->GetParameter().id == ACTOR_ID::ENEMY_THREADWEB_ACTOR && player._Get()->GetParameter().id == ACTOR_ID::ENEMY_ACTOR)){
					ChangeAction(ACTION_ID::THREAD_WEB_ACTION);
					player._Get()->SetThreadWeb(threadWebWeak._Get()->shared_from_this());
					ride = true;
					change = true;
				}
			}
		}

		if (threadWebWeak._Get() == nullptr){
			for (auto i : threadVec){
				ThreadParameter threadParam = i._Get()->GetThreadParameter();
				Vector3 threadVec = threadParam.startNormal;
				if (RCVector3::length(threadParam.startPosition - playerPos) <
					RCVector3::length(threadParam.currentEndPosition - playerPos)){
					threadVec = threadParam.endNormal;
				}
				threadVec = RCVector3::normalize(threadVec);
				if (lowAngle > Math::acos(RCVector3::dot(threadVec, cameraVec))){
					lowAngle = Math::acos(RCVector3::dot(threadVec, cameraVec));
					threadWeak = i;
				}
			}
			if (threadWeak._Get() != nullptr){
				threadWeak._Get()->SetSelectThread();
				//ボタン入力で巻取りを開始
				if ((Device::GetInstance().GetInput()->MouseButtonDown(INPUTMOUSEBUTTON::RIGHT_BUTTON, true) ||
					Device::GetInstance().GetInput()->GamePadButtonDown(padNum, GAMEPADKEY::BUTTON_R2, true)) &&
					thisAction != ACTION_ID::THREAD_ACTION){
					if ((threadWeak._Get()->GetParameter().id == ACTOR_ID::PLAYER_THREAD_ACTOR && player._Get()->GetParameter().id == ACTOR_ID::PLAYER_ACTOR) ||
						(threadWeak._Get()->GetParameter().id == ACTOR_ID::ENEMY_THREAD_ACTOR && player._Get()->GetParameter().id == ACTOR_ID::ENEMY_ACTOR)){
						player._Get()->SetThread(threadWeak);
						ChangeAction(ACTION_ID::REWIND_ACTION);
					}
				}

				if (Device::GetInstance().GetInput()->KeyDown(INPUTKEY::KEY_SPACE, true) || Device::GetInstance().GetInput()->GamePadButtonDown(padNum, GAMEPADKEY::BUTTON_R3, true)){
					if ((threadWeak._Get()->GetParameter().id == ACTOR_ID::PLAYER_THREAD_ACTOR && player._Get()->GetParameter().id == ACTOR_ID::PLAYER_ACTOR) ||
						(threadWeak._Get()->GetParameter().id == ACTOR_ID::ENEMY_THREAD_ACTOR && player._Get()->GetParameter().id == ACTOR_ID::ENEMY_ACTOR)){
						ChangeAction(ACTION_ID::THREAD_ACTION);
						player._Get()->SetThread(threadWeak._Get()->shared_from_this());
						change = true;
						ride = true;
					}
				}
			}
		}
	}
}