示例#1
0
    void Awake()
    {
        walkerComp   = GetComponent <BezierWalker>();
        headTrans    = (GetComponentInChildren(typeof(HeadTransform), true) as HeadTransform).transform;
        curveDisplay = GetComponentInChildren(typeof(CurveDisplay), true) as CurveDisplay;
        frontDisplay = GetComponentInChildren(typeof(FrontDisplay), true) as FrontDisplay;
        animator     = GetComponentInChildren(typeof(Animator), true) as Animator;

        if (isMonitor)
        {
            //regardless to whoever
            cameraTrans.gameObject.SetActive(true);
            cameraTrans.parent   = cameraParent;
            cameraTrans.position = cameraParent.position;
            cameraTrans.rotation = cameraParent.rotation;
            curveDisplay.gameObject.SetActive(true);
            frontDisplay.gameObject.SetActive(true);
        }
        else
        {
            if (id == StaticData.playerId)
            {
                cameraTrans.parent        = cameraParent;
                cameraTrans.localPosition = Vector3.zero;
                cameraTrans.localRotation = Quaternion.identity;
                curveDisplay.gameObject.SetActive(true);
                frontDisplay.gameObject.SetActive(true);
            }
            else
            {
                curveDisplay.gameObject.SetActive(false);
                frontDisplay.gameObject.SetActive(false);
            }
        }
    }