Exemplo n.º 1
0
    void Start()
    {
        if (m_BindObj != null)
        {
            Obj_OtherPlayer objOtherPlayer = m_BindObj.GetComponent <Obj_OtherPlayer>();
            if (null != objOtherPlayer)
            {
                // 关于直接创建坐骑上的玩家的名字板高度修正 应该也会执行一次Obj_Mount的RideMount 相当于设置了两次高度 没什么大影响 暂时不删除此处
                m_fDeltaHeight = objOtherPlayer.DeltaHeight + objOtherPlayer.GetMountNameBoardHeight();
            }
            else
            {
                Obj_Character objCharacter = m_BindObj.GetComponent <Obj_Character>();
                if (null != objCharacter)
                {
                    m_fDeltaHeight = objCharacter.DeltaHeight;
                }
            }

            m_Position     = new Vector3(0, m_fDeltaHeight, 0);
            m_BindObjTrans = m_BindObj.transform;
        }

        m_Transform = transform;
    }
Exemplo n.º 2
0
    static void OnLoadHeadInfo(GameObject resObj, object parent, object fun)
    {
        if (null != resObj)
        {
            if (null != GameManager.gameManager.ActiveScene.NameBoardRoot)
            {
                resObj.transform.parent = GameManager.gameManager.ActiveScene.NameBoardRoot.transform;
            }

            resObj.transform.localPosition = Vector3.zero;
            resObj.transform.localRotation = Quaternion.LookRotation(Vector3.forward);
            BillBoard billboard = resObj.GetComponent <BillBoard>();
            if (null == billboard)
            {
                billboard = resObj.AddComponent <BillBoard>();
                if (null != billboard)
                {
                    billboard.BindObj = parent as GameObject;
                }
            }
            else
            {
                billboard.BindObj = parent as GameObject;
                billboard.enabled = true;
            }

            //由于会复用,所以需要重新设置名字版的高度修正
            if (null != billboard && null != billboard.BindObj)
            {
                Obj_OtherPlayer objOtherPlayer = billboard.BindObj.GetComponent <Obj_OtherPlayer>();
                if (null != objOtherPlayer)
                {
                    billboard.fDeltaHeight = objOtherPlayer.DeltaHeight + objOtherPlayer.GetMountNameBoardHeight();
                }
                else
                {
                    Obj_Character objCharacter = billboard.BindObj.GetComponent <Obj_Character>();
                    if (null != objCharacter)
                    {
                        billboard.fDeltaHeight = objCharacter.DeltaHeight;
                    }
                }
            }

            LoadHeadInfoDelegate delFun = fun as LoadHeadInfoDelegate;
            if (null != delFun)
            {
                delFun(resObj);
            }
        }
        else
        {
            LogModule.ErrorLog("load headinfo fail");
        }
    }
Exemplo n.º 3
0
    // 骑马
    static public void RideMount(Obj_OtherPlayer PlayerObj, int nMountID)
    {
        if (null == PlayerObj)
        {
            return;
        }

        Tab_MountBase MountBase = TableManager.GetMountBaseByID(nMountID, 0);

        if (null == MountBase)
        {
            LogModule.DebugLog("MountBase.txt has not Line ID=" + nMountID);
            return;
        }
        Tab_CharMount MountTable = TableManager.GetCharMountByID(MountBase.ModelID, 0);

        if (MountTable == null)
        {
            LogModule.DebugLog("CharMount.txt has not Line ID=" + MountBase.ModelID);
            return;
        }
        GameObject Obj = PlayerObj.gameObject;

        if (Obj != null)
        {
            if (PlayerObj.MountObj) // 换个马
            {
                if (PlayerObj.MountObj.MountID > 0)
                {
                    if (PlayerObj.MountObj.MountID == nMountID)
                    {
                        return;
                    }
                    PlayerObj.MountObj.ChangeMount(PlayerObj, nMountID);
                }
            }
            else //  创建个马
            {
                GameObject MountPlayerObj = ResourceManager.InstantiateResource("Prefab/Model/PlayerRoot", "MountPlayer") as GameObject;
                if (MountPlayerObj != null)
                {
                    PlayerObj.MountObj = MountPlayerObj.AddComponent <Obj_Mount>() as Obj_Mount;

                    if (PlayerObj.MountObj)
                    {
                        PlayerObj.MountObj.InitMount(PlayerObj, nMountID);
                    }
                }
            }

            if (PlayerObj.MountObj)
            {
                PlayerObj.MountObj.MountID = nMountID;
            }

            // 上坐骑时名字板高度修正
            if (PlayerObj.HeadInfoBoard != null)
            {
                BillBoard billboard = PlayerObj.HeadInfoBoard.GetComponent <BillBoard>();
                if (billboard != null)
                {
                    billboard.fDeltaHeight = PlayerObj.DeltaHeight + PlayerObj.GetMountNameBoardHeight();
                }
            }
        }
    }