示例#1
0
文件: Fear.cs 项目: Kundara/project1
		// Use this for initialization
		void Start () {
			characters = FindObjectsOfType<Character>();
			grenade = GetComponent<Grenade>();
			startTime = Time.time;
		}
示例#2
0
        void Start()
        {
            isOffline = GameObject.FindObjectOfType<PlayersManager> ().isOffline;

            GameObject[] players = GameObject.FindGameObjectsWithTag (Tags.GameController);

            grenadeController = GetComponentInChildren<Grenade> ();
            grenadeController.shooterID = shooterID;
            rocket.GetComponent<Rocket>().shooterID = shooterID;
            grenadeController.damage = damage;
            grenadeController.radius = radius;

            rocketHolder = transform.gameObject;

            foreach (GameObject player in players) {
                if (player.name == shooterID) {
                    _inputManager = player.GetComponentInChildren<InputManager> ();
                    _inputManager.SetRocketMode (true);
                    grenadeController.isDecider = true;
                    // find camera
                    if (!isOffline && _inputManager._isLocalPlayer) {
                        // online
                        mainCamera = Camera.main.GetComponent<CameraController> ();
                        mainCamera.target = this.gameObject;
                    }
                }
            }

            Quaternion initialRotation = Quaternion.LookRotation (initialVelocity, Vector3.back);
            initialRotation.x = 0f;
            initialRotation.y = 0f;
            transform.rotation = initialRotation;

            lastVelocities = new Vector2[velocityBuffer];
            volume = audioSource.volume;
            audioSource.volume = 0f;
            audioSource.Play();
        }