Ejemplo n.º 1
0
void Minions::NomalUpdate(void)
{
	if (_Time + _PatTime < TIMEMANAGER->GetTotalTime())
	{
		_Time = TIMEMANAGER->GetTotalTime();

		int Pick = rand() & 3;
		if (Pick == 0)
		{
			Play("Wait");
			_Patten = NOMAL_WAIT;
			PickSound();
		}
		else if (Pick == 1)
		{
			Play("Unarmedwait");
			_Patten = NOMAL_WAIT2;
			PickSound();
		}
		else if (Pick == 2)
		{
			Play("Walk");
			_Patten = NOMAL_WALK;
			_Angle = RandomFloatRange(-0.01, 0.01);
		}
		if (_PrevPatten != _Patten)
		{
			_PrevPatten = _Patten;
		}
		else
		{
			_Patten = NOMAL_WALK;
			_PrevPatten = NOMAL_NULL;
			Play("Walk");
			_Angle = RandomFloatRange(-0.01, 0.01);
		}
	}

	switch (_Patten)
	{
	case Minions::NOMAL_WAIT:
		break;
	case Minions::NOMAL_WAIT2:
		break;
	case Minions::NOMAL_WALK:
		_MainTrans->MovePositionSelf(0, 0, Speed);
		_MainTrans->RotateSelf(0, _Angle, 0);
		break;
	default:
		break;
	}

	float Len = calculateLen(_MainTrans->GetWorldPosition(), _TargetTrans->GetWorldPosition());
	if (Len < 20)
	{
		_State = FIND;
		Play("Walk");
		PickSound();
	}
}
Ejemplo n.º 2
0
HRESULT Minions::init()
{
	Monster::init();

	_State = NOMAL;
	_Patten = NOMAL_WAIT;
	_PrevPatten = NOMAL_NULL;

	_PatTime = RandomFloatRange(3, 6);
	return S_OK;
}
Ejemplo n.º 3
0
void Spikoticon::NextDirection() {
	// random direction	
	int type = (int)RandomFloatRange(0, 4);
	steps = (int)RandomFloatRange(10, 500);
	// spawn enemy
	switch(type) {
		case 0: {
			direction = Vector2::UP;
			break;
		}
		case 1: {
			direction = Vector2::DOWN;
			break;
		}
		case 2: {
			direction = Vector2::LEFT;
			break;
		}
		case 3: {
			direction = Vector2::RIGHT;
			break;
		}
	}
}
Ejemplo n.º 4
0
void customize_Scene::MouseClick(void)
{

	if (PtInRect(&_HairLeft.rc, GetMousePos()))
	{
		if (HairNum > -1)
		{
			HairNum--;
			Push = true;
		}
		else
		{
			HairNum = _vHair.size() - 1;
			Push = true;
		}
	}
	else if (PtInRect(&_HairRight.rc, GetMousePos()))
	{
		if (HairNum < _vHair.size() - 1 || HairNum == -1)
		{
			HairNum++;
			Push = true;
		}
		else
		{
			HairNum = -1;
			Push = true;
		}
	}
	else if (PtInRect(&_HeadLeft.rc, GetMousePos()))
	{
		if (HeadNum > 0)
		{
			PrevNum2 = HeadNum;
			HeadNum--;
			Push2 = true;
		}
		else
		{
			PrevNum2 = HeadNum;
			HeadNum = _vHead.size() - 1;
			Push2 = true;
		}
	}
	else if (PtInRect(&_HeadRight.rc, GetMousePos()))
	{
		if (HeadNum < _vHead.size() - 1)
		{
			PrevNum2 = HeadNum;
			HeadNum++;
			Push2 = true;
		}
		else
		{
			PrevNum2 = HeadNum;
			HeadNum = 0;
			Push2 = true;
		}

	}
	else if (PtInRect(&_CameraFace.rc, GetMousePos()))
	{
		Z = 2;
		Y = 4.5;
		LookY = 4.3;
	}
	else if (PtInRect(&_CameraBody.rc, GetMousePos()))
	{
		Z = 6;
		Y = 4.5;
		LookY = 2;
	}
	else if (PtInRect(&_Plus.rc, GetMousePos()))
	{
		if (Z > 0.5)
		Z -= 0.2;
	}
	else if (PtInRect(&_Minus.rc, GetMousePos()))
	{
		if (Z < 10)
			Z += 0.2;
	}
	else if (PtInRect(&_Up.rc, GetMousePos()))
	{
		Y += 0.2;
	}
	else if (PtInRect(&_Down.rc, GetMousePos()))
	{
		Y -= 0.2;
	}
	else if (PtInRect(&_LookUp.rc, GetMousePos()))
	{
		LookY += 0.2;
	}
	else if (PtInRect(&_LookDown.rc, GetMousePos()))
	{
		LookY -= 0.2;
	}
	else if (PtInRect(&_AtkAni1.rc, GetMousePos()))
	{
		if (!Ani)
		{
			PlayOneShot("Combo1_Double");
			Ani = true;
		}
	}
	else if (PtInRect(&_AtkAni2.rc, GetMousePos()))
	{
		if (!Ani)
		{
			PlayOneShot("Combo2_Double");
			Ani = true;
		}
	}
	else if (PtInRect(&_GuardAni.rc, GetMousePos()))
	{
		if (!Ani)
		{
			PlayOneShot("Idle3");
			Ani = true;
		}
	}
	else if (PtInRect(&_MoveAni.rc, GetMousePos()))
	{
		if (!Ani)
		{
			PlayOneShot("Run");
			Ani = true;
		}		
	}
	else if (PtInRect(&_Ok.rc, GetMousePos()))
	{
		if (HairNum == -1)
		{
			SCENEMANAGER->FindScece("game")->TempHair = "없음";
		}
		else
		{
			SCENEMANAGER->FindScece("game")->TempHair = _vHair[HairNum]->filePath;
		}
		SCENEMANAGER->FindScece("game")->TempHead = _vHead[HeadNum]->filePath;
		SCENEMANAGER->FindScece("game")->TempColor = _HairColor;
		
		for (int i = 0; i < _vHead.size(); i++)
		{
			if (i == HeadNum)continue;
			RESOURCE_SKINNEDXMESH->RemoveResource(_vHead[i]->filePath);
		}
		if (HairNum == -1)
		{
			for (int i = 0; i < _vHair.size(); i++)
			{
				RESOURCE_SKINNEDXMESH->RemoveResource(_vHair[i]->filePath);
			}
		}
		else
		{
			for (int i = 0; i < _vHair.size(); i++)
			{
				if (i == HairNum)continue;
				RESOURCE_SKINNEDXMESH->RemoveResource(_vHair[i]->filePath);
			}
		}
		//RESOURCE_TEXTURE->ClearResource();
		SCENEMANAGER->ChangeScene("game");
	} 
	else if (PtInRect(&_ColorBarControlR.rc, GetMousePos()))
	{
		R = true; WINSIZEX; WINSIZEY;
	}
	else if (PtInRect(&_ColorBarControlG.rc, GetMousePos()))
	{
		G = true;
	}
	else if (PtInRect(&_ColorBarControlB.rc, GetMousePos()))
	{
		B = true;
	}
	else if (PtInRect(&_ColorBarControlA.rc, GetMousePos()))
	{
		A = true;
	}
	else if (PtInRect(&_ColorBlue.rc, GetMousePos()))
	{
		_ColorBarControlR.x = 995;
		_ColorBarControlG.x = 995;
		_ColorBarControlB.x = 1180;
		_ColorBarControlR.rc = RectMakeCenter(_ColorBarControlR.x, _ColorBarControlR.y, 32, 32);
		_ColorBarControlG.rc = RectMakeCenter(_ColorBarControlG.x, _ColorBarControlG.y, 32, 32);
		_ColorBarControlB.rc = RectMakeCenter(_ColorBarControlB.x, _ColorBarControlB.y, 32, 32);
		_R = _ColorBarControlR.x - 995;
		_G = _ColorBarControlG.x - 995;
		_B = _ColorBarControlB.x - 995;
	}
	else if (PtInRect(&_ColorBlack.rc, GetMousePos()))
	{
		_ColorBarControlR.x = 995;
		_ColorBarControlG.x = 995;
		_ColorBarControlB.x = 995;
		_ColorBarControlR.rc = RectMakeCenter(_ColorBarControlR.x, _ColorBarControlR.y, 32, 32);
		_ColorBarControlG.rc = RectMakeCenter(_ColorBarControlG.x, _ColorBarControlG.y, 32, 32);
		_ColorBarControlB.rc = RectMakeCenter(_ColorBarControlB.x, _ColorBarControlB.y, 32, 32);
		_R = _ColorBarControlR.x - 995;
		_G = _ColorBarControlG.x - 995;
		_B = _ColorBarControlB.x - 995;
	}
	else if (PtInRect(&_ColorGreen.rc, GetMousePos()))
	{
		_ColorBarControlR.x = 995;
		_ColorBarControlG.x = 1180;
		_ColorBarControlB.x = 995;
		_ColorBarControlR.rc = RectMakeCenter(_ColorBarControlR.x, _ColorBarControlR.y, 32, 32);
		_ColorBarControlG.rc = RectMakeCenter(_ColorBarControlG.x, _ColorBarControlG.y, 32, 32);
		_ColorBarControlB.rc = RectMakeCenter(_ColorBarControlB.x, _ColorBarControlB.y, 32, 32);
		_R = _ColorBarControlR.x - 995;
		_G = _ColorBarControlG.x - 995;
		_B = _ColorBarControlB.x - 995;
	}
	else if (PtInRect(&_ColorRed.rc, GetMousePos()))
	{
		_ColorBarControlR.x = 1180;
		_ColorBarControlG.x = 995;
		_ColorBarControlB.x = 995;
		_ColorBarControlR.rc = RectMakeCenter(_ColorBarControlR.x, _ColorBarControlR.y, 32, 32);
		_ColorBarControlG.rc = RectMakeCenter(_ColorBarControlG.x, _ColorBarControlG.y, 32, 32);
		_ColorBarControlB.rc = RectMakeCenter(_ColorBarControlB.x, _ColorBarControlB.y, 32, 32);
		_R = _ColorBarControlR.x - 995;
		_G = _ColorBarControlG.x - 995;
		_B = _ColorBarControlB.x - 995;
	}
	else if (PtInRect(&_ColorSky.rc, GetMousePos()))
	{
		_ColorBarControlR.x = 995;
		_ColorBarControlG.x = 1180;
		_ColorBarControlB.x = 1180;
		_ColorBarControlR.rc = RectMakeCenter(_ColorBarControlR.x, _ColorBarControlR.y, 32, 32);
		_ColorBarControlG.rc = RectMakeCenter(_ColorBarControlG.x, _ColorBarControlG.y, 32, 32);
		_ColorBarControlB.rc = RectMakeCenter(_ColorBarControlB.x, _ColorBarControlB.y, 32, 32);
		_R = _ColorBarControlR.x - 995;
		_G = _ColorBarControlG.x - 995;
		_B = _ColorBarControlB.x - 995;
	}
	else if (PtInRect(&_ColorYellow.rc, GetMousePos()))
	{
		_ColorBarControlR.x = 1180;
		_ColorBarControlG.x = 1180;
		_ColorBarControlB.x = 995;
		_ColorBarControlR.rc = RectMakeCenter(_ColorBarControlR.x, _ColorBarControlR.y, 32, 32);
		_ColorBarControlG.rc = RectMakeCenter(_ColorBarControlG.x, _ColorBarControlG.y, 32, 32);
		_ColorBarControlB.rc = RectMakeCenter(_ColorBarControlB.x, _ColorBarControlB.y, 32, 32);
		_R = _ColorBarControlR.x - 995;
		_G = _ColorBarControlG.x - 995;
		_B = _ColorBarControlB.x - 995;
	}
	else if (PtInRect(&_ColorRand.rc, GetMousePos()))
	{
		_ColorBarControlR.x = RandomFloatRange(995,1180);
		_ColorBarControlG.x = RandomFloatRange(995,1180);
		_ColorBarControlB.x = RandomFloatRange(995,1180);
		_ColorBarControlR.rc = RectMakeCenter(_ColorBarControlR.x, _ColorBarControlR.y, 32, 32);
		_ColorBarControlG.rc = RectMakeCenter(_ColorBarControlG.x, _ColorBarControlG.y, 32, 32);
		_ColorBarControlB.rc = RectMakeCenter(_ColorBarControlB.x, _ColorBarControlB.y, 32, 32);
		_R = _ColorBarControlR.x - 995;
		_G = _ColorBarControlG.x - 995;
		_B = _ColorBarControlB.x - 995;
	}
	//pMainCamera->GetWorldPosToScreenPos()
}