void CBaseGolem::HandleEvent( Event* _toHandle )
{
	//include all the events all the golems respond to
	if( _toHandle->GetEventID() == "ATTRACTORPLACED" )
	{
		CAttractor* placedAttr = (CAttractor*)_toHandle->GetParam() ;
		if( placedAttr->GetElemType() == this->GetGolemType() )
		{								
			if(this->GetLayerLocation() != placedAttr->GetLayerLocation())
				return;

			//start moving toward our target
			SetTargetPos( placedAttr->GetIndexPosX() , placedAttr->GetIndexPosY() ) ;
			SetMoveType(TARGET_MOVE);
		}
	}
	else if( _toHandle->GetEventID() == "ATTRACTORREMOVED" )
	{
		CAttractor* attr = (CAttractor*)_toHandle->GetParam() ;
		if( !attr )
			return;
		
		// ATTRACTOR REMOVED ON DIFFERENT LEVEL?
		if( GetTargetPosX() == attr->GetIndexPosX() && GetTargetPosY() == attr->GetIndexPosY() )
		{
			ClearTarget();
		}
	}
}
Esempio n. 2
0
void cScenarioArmRL::SetCtrlTargetPos(const tVector& target)
{
	cScenarioArm::SetCtrlTargetPos(target);
	auto coach = GetCoachController();
	if (coach != nullptr)
	{
		coach->SetTargetPos(target);
	}
}
Esempio n. 3
0
/*OpenGL坐标轴方向:
*	x轴:屏幕左下角->右下角
*	y轴:屏幕左下角->左上角
*	z轴:向外
* 物体摆放方向:面向x轴正方向,头顶朝向y轴正方向
*/
Camera::Camera()
{
	SetEyePos(0.0f, 0.0f, 0.0f);
	SetTargetPos(1.0f, 0.0f, 0.0f);

	m_aspect = 90.0f;
	m_ratioWH = 1.3333333f; //大约对应于宽640,高480
	m_near = 0.1f;
	m_far = 700.0f;
}
Esempio n. 4
0
void ShootType::ShootMissile(const b2Vec2& initPos)
{
    auto missile = new Missile();

    missile->SetDynamicBody(m_Owner, m_MissileType, initPos, m_MissileScale);
    missile->SetTargetPos(m_TargetPos);
    missile->SetSpeed(m_MissileSpeed);
    missile->SetDamage(m_Damage);
    missile->SetRange(m_Range);
	missile->SetMaxHp(m_MissileHp);
	missile->SetHp(m_MissileHp);
    missile->MissileShoot();
}
Esempio n. 5
0
void BulletNode::SetupTarget()
{
			
	PVRTMATRIX weaponRotaionMtx = mDirectionNode->GetWorldMtx();
	
	PVRTMat4 mat(weaponRotaionMtx.f);
	PVRTVec4 zVec(0, 0 , mRange, 1.0f);
	zVec = mat * zVec;

	PVRTVec3 targetPos;
	
	
	targetPos.x = zVec.x;
	targetPos.y = zVec.y;
	targetPos.z = zVec.z;

	SetTargetPos(targetPos);
}
Esempio n. 6
0
void CFighterMediator::OnClientCommand(const CGac2GasCPP_SetTargetPos* pCmd)
{
	SetTargetPos(pCmd->Pos);
}
Esempio n. 7
0
void plCameraModifier1::Update()
{
    // update the brain

    // this freeze thing is a useful debugging tool...  
    if (plVirtualCam1::Instance()->freeze)
        return;
    
    if (GetBrain())
    {
        if (fUpdateBrainTarget && fTarget->GetCoordinateInterface()) // if we need to update the brain and the target is loaded
        {
            fUpdateBrainTarget = false;
            GetBrain()->AddTarget(); // update the brain's target
        }

        bool moveInSub = !(GetBrain()->HasFlag(plCameraBrain1::kIgnoreSubworldMovement));

        if (moveInSub && GetBrain()->GetSubject())
        {
            plKey worldKey = nil;

            // First check if this is a physical.  If so, grab the subworld from that
            if (GetBrain()->GetSubject()->GetSimulationInterface())
            {
                plPhysical* phys = GetBrain()->GetSubject()->GetSimulationInterface()->GetPhysical();
                if (phys)
                    worldKey = phys->GetWorldKey();
            }
            // Also, check if this is an avatar.  They don't have physicals, you
            // have to ask the avatar controller for the subworld key.
            if (!worldKey)
            {
                plKey subject = plKey(GetBrain()->GetSubject()->GetKey());
                plArmatureMod* armMod = plAvatarMgr::FindAvatar(subject);
                if (armMod && armMod->GetController() )
                    worldKey = armMod->GetController()->GetSubworld();
            }

            if (worldKey)
            {
                // this picks up and moves the camera to it's previous subworld coordinate (so the subworld isn't moving out from underneath us)
                hsMatrix44 l2w, w2l;
                plSceneObject* so = plSceneObject::ConvertNoRef(worldKey->ObjectIsLoaded());
                if (so)
                {
                    l2w = so->GetLocalToWorld();
                    w2l = so->GetWorldToLocal();

                    if (fInSubLastUpdate)
                    {
                        if (!(fLastSubPos == fFrom && fLastSubPOA == fAt))
                        {
                            SetTargetPos(l2w * fLastSubPos);
                            SetTargetPOA(l2w * fLastSubPOA);
                        }
                    }
                    else
                    {
                        fInSubLastUpdate = true;
                    }
                    GetBrain()->Update();
                    fLastSubPos = w2l * GetTargetPos();
                    fLastSubPOA = w2l * GetTargetPOA();
                }
                return;
            }
            else
            {
                fInSubLastUpdate = false;
            }
        }
        GetBrain()->Update();
        fLastSubPos = GetTargetPos();
        fLastSubPOA = GetTargetPOA();
    }
}