コード例 #1
0
    //// 没用到 public void RemoveLogicEvent(int nLogicCount)
    ////{
    ////    _LOGIC_EVENT pLogicEvent;
    ////    for (int i = 0; i < m_listLogicEvent.Count; i++)
    ////    {
    ////        pLogicEvent = m_listLogicEvent[i];
    ////        if (pLogicEvent.m_nSenderLogicCount == nLogicCount)
    ////        {
    ////            m_listLogicEvent.RemoveAt(i);
    ////            break;
    ////        }
    ////    }
    ////}

    private void DoLogicEvent_Bullet(_LOGIC_EVENT pLogicEvent)
    {
        if (pLogicEvent != null)
        {
            _LOGIC_EVENT_BULLET pBulletInfo = pLogicEvent.m_bullet;
            CObject             pSender     = CObjectManager.Instance.FindServerObject((int)pLogicEvent.m_nSenderID);
            if (pSender != null)
            {
                UnityEngine.Vector3 fvSenderPos      = new UnityEngine.Vector3();
                UnityEngine.Vector3 fvSenderRot      = UnityEngine.Vector3.zero;
                CObject_Character   pCharacterSender = (CObject_Character)pSender;
                fvSenderPos    = pSender.GetPosition();
                fvSenderPos.y += 1.0f;                //temp code
                fvSenderRot.y  = pSender.GetFaceDir();
                if (pCharacterSender != null)
                {
                    if (pBulletInfo.m_pszSenderLocator.Length > 0 &&
                        pCharacterSender.GetRenderInterface() != null)
                    {
                        pCharacterSender.GetRenderInterface().GetLocator(pBulletInfo.m_pszSenderLocator, ref fvSenderPos);
                    }
                }

                SObject_BulletInit initBullet = new SObject_BulletInit();
                initBullet.m_fvPos           = fvSenderPos;
                initBullet.m_fvRot           = fvSenderRot;
                initBullet.m_idSend          = pLogicEvent.m_nSenderID;
                initBullet.m_nSendLogicCount = pLogicEvent.m_nSenderLogicCount;
                initBullet.m_nBulletID       = pBulletInfo.m_nBulletID;
                initBullet.m_bSingleTarget   = pBulletInfo.m_bHitTargetObj;
                if (pBulletInfo.m_bHitTargetObj)
                {
                    initBullet.m_fvTargetPos = new Vector3(-1.0f, -1.0f, -1.0f);
                    initBullet.m_idTarget    = (int)pBulletInfo.m_nTargetID;
                }
                else
                {
                    initBullet.m_fvTargetPos.x = pBulletInfo.m_fTargetX;
                    initBullet.m_fvTargetPos.z = pBulletInfo.m_fTargetZ;
                    initBullet.m_fvTargetPos.y = GFX.GfxUtility.getSceneHeight(pBulletInfo.m_fTargetX, pBulletInfo.m_fTargetZ);
                }

                CObject_Bullet pBullet = CObjectManager.Instance.NewBullet(-1);
                pBullet.Initial(initBullet);
            }
        }
    }
コード例 #2
0
 void Update()
 {
     if (mRotating)
     {
         if (mCurrentRoleType == RoleType.ROLE_SELF)
         {
             CObject fakeObject = CObjectManager.Instance.getPlayerMySelf().getAvatar();
             if (fakeObject != null)
             {
                 float curDir = fakeObject.GetFaceDir() + GameProcedure.s_pTimeSystem.GetDeltaTime() / 1000.0f * mRotateSpeed;
                 fakeObject.SetFaceDir(curDir);
             }
         }
         else
         {
             SDATA_PET curPet = CDataPool.Instance.Pet_GetValidPet(ActivePet);//CDataPool.Instance.Pet_GetPet((int)mCurrentRoleType - 1);
             if (curPet != null && curPet.FakeObject != null)
             {
                 float curDir = curPet.FakeObject.GetFaceDir() + GameProcedure.s_pTimeSystem.GetDeltaTime() / 1000.0f * mRotateSpeed;
                 curPet.FakeObject.SetFaceDir(curDir);
             }
         }
     }
 }