Ejemplo n.º 1
0
    public GameObject carCamera;//摄像机

    public void InitCar(Transform varParent, GamePlayer player)
    {
        if (player.isLocalPlayer)
        {
            carCamera = GameObject.FindObjectOfType <RCC_Camera>().gameObject;
            carCamera.SetActive(false);
        }

        //RCC_CarControllerV3 carPrefab = Resources.Load<RCC_CarControllerV3>("Prefabs/E37");//加载预制体
        //RCC_CarControllerV3 car = Instantiate<RCC_CarControllerV3>(carPrefab);//实例化车
        //car.transform.SetParent(varParent);//设置车辆父级
        //car.transform.localPosition = Vector3.zero;
        //car.transform.localRotation = Quaternion.identity;
        //car.transform.localScale = Vector3.one;

        if (player.isLocalPlayer)
        {
            RCC_EnterExitCar rccCar = gameObject.AddComponent <RCC_EnterExitCar>();
            rccCar.SetCarCamera(carCamera);
        }

        GameObject ob = new GameObject("Player");

        Transform playerObj = transform.Find("PlayerObj");

        gameObject.SendMessage("Act", ob, SendMessageOptions.DontRequireReceiver);
        GetComponent <RCC_CarControllerV3>().SetPlayer(player);

        Debug.Log("PlayerControllerInitCar");
    }
Ejemplo n.º 2
0
    void Awake()
    {
        manage        = this;
        carController = GetComponent <RCC_CarControllerV3>();
        carCamera     = GameObject.FindObjectOfType <RCC_Camera>().gameObject;
        if (!getOutPos)
        {
            GameObject geto = new GameObject("Get Out From Car");
            geto.transform.SetParent(transform);
            geto.transform.localPosition                = new Vector3(-3f, 0f, 0f);
            geto.AddComponent <BoxCollider>().tag       = "inOut";
            geto.GetComponent <BoxCollider>().isTrigger = true;
            getOutPos = geto.transform;
        }


        if (!getOutPosition)
        {
            GameObject getOutPos = new GameObject("Get Out Position");
            getOutPos.transform.SetParent(transform);
            getOutPos.transform.localPosition = new Vector3(-3f, 0f, 0f);
            getOutPos.transform.localRotation = Quaternion.identity;
            getOutPosition = getOutPos.transform;
        }
    }
Ejemplo n.º 3
0
    public GameObject carCamera;//摄像机

    public void InitCar(Transform varParent, GamePlayer player)
    {
        carCamera = GameObject.FindObjectOfType <RCC_Camera>().gameObject;
        carCamera.SetActive(false);

        RCC_EnterExitCar rccCar = gameObject.AddComponent <RCC_EnterExitCar>();

        rccCar.SetCarCamera(carCamera);

        GameObject ob = new GameObject("Player");

        gameObject.SendMessage("Act", ob, SendMessageOptions.DontRequireReceiver);
    }
Ejemplo n.º 4
0
 void Start()
 {
     car = FindObjectOfType <RCC_EnterExitCar>();
     rb  = GetComponent <Rigidbody>();
 }