////获取手柄上的射线 //private Ray GetControllerRay(GameObject obj) //{ // if (obj == null) // { // Debug.LogError("Controller--------------GetControllerRay---obj is null!!!"); // return new Ray(); // } // RayController rayController = obj.GetComponent<RayController>(); // if (rayController == null) // rayController = obj.AddComponent<RayController>(); // rayController.Init(); // if (rayController == null) // { // Debug.LogError("Controller--------------GetControllerRay---RayController is null!!!"); // return new Ray(); // } // return rayController.GetRay(); //} /* * 控制CV手柄射线的显示隐藏 */ private void ControlCVRayShow(GameObject obj, bool isShow) { if (obj == null) { Debug.LogError("Controller--------------ControlCVRayShow---obj is null!!!"); return; } RayController rayController = obj.GetComponent <RayController>(); if (rayController == null) { Debug.LogError("Controller--------------ControlCVRayShow---RayController is null!!!"); //return; rayController = obj.AddComponent <RayController>(); rayController.Init(); } Debug.Log(" ----- Controller ------ " + "PUI--------------ControlCVRayShow : " + obj.name + " " + isShow); if (isShow) { rayController.SetEnable(); } else { rayController.SetDisable(); } }
private void Start() { rayController = this.GetComponentInChildren <RayController>(); this.UpdateAsObservable() .Where(_ => GameManager.GameState == GameState.select && Selecting == true) .Subscribe(_ => rayController.PlayerSelect()) .AddTo(this); _selecting .ThrottleFirst(TimeSpan.FromSeconds(1)) .Where(x => GameManager.GameState == GameState.select && this.gameObject.activeSelf && x == false) .Subscribe(_ => { rayController.Selectinit(); if (GameManager.PlayerTurn == 1) { GameManager.PlayerTurn = 2; } else if (GameManager.PlayerTurn == 2) { GameManager.PlayerTurn = 1; } GameManager.GameState = GameState.interval; }) .AddTo(this); }
void Start() { _rb = GetComponentInParent <Rigidbody>(); _carController = GetComponentInParent <RayController>(); _minLength = restLength - springTravel; _maxLength = restLength + springTravel; _springLength = _maxLength; }
private void Awake() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } }
private void Awake() { _gameManager = FindObjectOfType <GameManager>(); _rayController = FindObjectOfType <RayController>(); _materials = _gameManager.WallColors; _currentMaterial = Random.Range(0, _gameManager.WallColors.Length); var selectedMaterial = _materials[_currentMaterial]; ChangeMaterial(selectedMaterial); _rayController.ShootBallEvent += OnShootBallEvent; }
void Awake() { playerRigidBody = GameObject.Find("player").GetComponent <Rigidbody2D> (); playerRigidBody.velocity = new Vector2(runSpeed, playerRigidBody.velocity.y); playerController = GameObject.Find("player").GetComponent <RayController>(); }
private void Awake() { Instance = this; }
// Start is called before the first frame update void Start() { thePlayer = FindObjectOfType <RayController>(); lastPlayerPosition = thePlayer.transform.position; }
private void OnEnable() { _rayController = FindObjectOfType <RayController>(); _rigidbody = GetComponent <Rigidbody>(); _rayController.ShootBallEvent += OnShootBallEvent; }
void Start() { rayController = GetComponent <RayController>(); weaponController = GetComponent <WeaponController>(); playerCamera = GetComponent <Camera> (); }
// Use this for initialization void Start() { labelStyle = new GUIStyle(); labelStyle.alignment = TextAnchor.MiddleRight; labelStyle.fontSize = Screen.height / 25; labelStyle.normal.textColor = new Color (1.0f, 1.0f, 1.0f, 1.0f); //white sphereController = (SphereController) FindObjectOfType (typeof(SphereController)); rayController = (RayController) FindObjectOfType (typeof(RayController)); sphereCount = 0; lastTime = 0; Directory.CreateDirectory ("Data"); createNewLogFile(); }