Exemple #1
0
    /// <summary>
    /// Use this for initialization.
    /// </summary>
    void Start()
    {
        parentRig = this.transform.parent;
        if (parentRig == null)
        {
            Debug.LogError("Parent camera to empty game object for cameraRig", this);
        }

        follow      = GameObject.FindWithTag("Player").GetComponent <CharacterControllerLogic>();
        followXform = GameObject.FindWithTag("Player").transform;

        lookDir    = followXform.forward;
        curLookDir = followXform.forward;


        barEffect = GetComponent <BarsEffect> ();
        if (barEffect == null)
        {
            Debug.LogError("Attach a widescreen BarsEffect script to the camera.", this);
        }

        //Position and parent a GameObject where first person view should be
        firstPersonCamPos = new CameraPosition();
        firstPersonCamPos.Init
        (
            "First Person Camera",
            new Vector3(0.0f, 1.6f, 0.2f),
            new GameObject().transform,
            followXform
        );
    }
    // Use this for initialization
    void Start()
    {
        parentRig = this.transform;//.parent;
        if (parentRig == null)
        {
            Debug.LogError("Parent camera to empty GameObject.", this);
        }

        //follow = GameObject.FindWithTag("PlayerBody").GetComponent<CharacterController>();
        followXform = GameObject.FindWithTag("Player").transform;
        lookDir     = followXform.forward;
        curLookDir  = followXform.forward;

        //barEffect = GetComponent<BarsEffect>();
        //if (barEffect == null)
        //{
        //    Debug.LogError("Attach a widescreen BarsEffect script to the camera.", this);
        //}
        firstPersonCamPos = new CameraPosition();
        firstPersonCamPos.Init
        (
            "First Person Camera",
            new Vector3(0.0f, 1.6f, 0.2f),
            new GameObject().transform,
            follow.transform
        );
    }
    //// <summary>
    //// Use this for initialization
    //// </summary>
    void Start()
    {
        // Get character controller
        follow = GameObject.FindWithTag("Player").GetComponent <CharacterControllerLogic> ();
        if (follow == null)
        {
            Debug.LogError("Could not find CharacterControllerLogic.", this);
        }

        // setup transform for player
        followXform = GameObject.FindWithTag("FollowXform").transform;
        lookDir     = followXform.forward;

        // setup bar effect for target state
//				barEffect = GetComponent<BarsEffect> ();
//				if (barEffect == null) {
//						Debug.LogError ("Attach a widescreen BarsEffect script to the camera.", this);
//				}

        // Position and parent a GameObject where first person view should be
        firstPersonCamPos = new CameraPosition();
        firstPersonCamPos.Init
        (
            "First Person Camera",
            new Vector3(0.0f, firstPersonCamUp, firstPersonCamForward),
            new GameObject().transform,
            followXform
        );

        // store the default clipping plane
        camDefaultNearClippingPlane = this.camera.nearClipPlane;
    }
		/// <summary>
		/// Use this for initialization.
		/// </summary>
		void Start ()
		{
				parentRig = this.transform.parent;
				if (parentRig == null) {
						Debug.LogError ("Parent camera to empty GameObject.", this);
				}
		
				//follow = GameObject.FindWithTag ("Player").GetComponent<CharacterControllerLogic> ();
				//followXform = GameObject.FindWithTag ("Player").transform;
				if (follow == null || followXform == null) {
						Debug.LogError ("awaiting follow and followXform.", this);
						return;
				}
				lookDir = followXform.forward;
				curLookDir = followXform.forward;
		
				barEffect = GetComponent<BarsEffect> ();
				if (barEffect == null) {
						Debug.LogError ("Attach a widescreen BarsEffect script to the camera.", this);
				}
		
				// Position and parent a GameObject where first person view should be
				firstPersonCamPos = new CameraPosition ();
				firstPersonCamPos.Init (
					"FPCam",
					follow.transform
				);	
		}
	// Use this for initialization
	void Start ()
    { 
        lookDirection = following.forward;

        firstPersonCameraPosition = new CameraPosition();
        firstPersonCameraPosition.Init("First Person Camera",
                                        new Vector3(0f, 1.6f, .2f),
                                        new GameObject().transform,
                                        characterController.transform
                                      );

	}
    // Use this for initialization
    void Start()
    {
        player           = GameObject.FindGameObjectWithTag("Player").GetComponent <ThirdPersonUserControl>();
        player.m_CanMove = true;
        followXForm      = GameObject.FindGameObjectWithTag("PlayerFollow").transform;
        lookDir          = followXForm.forward;
        barEffect        = GetComponent <BarEffect>();
        if (!barEffect)
        {
            Debug.LogError("Attach the BarEffect to the camera", this);
        }

        firstPersonCamPos = new CameraPosition();
        firstPersonCamPos.Init("First Person Camera", new Vector3(0f, 1.4f, 0.2f), new GameObject().transform, player.transform);
    }
Exemple #7
0
    /// <summary>
    /// Use this for initialization.
    /// </summary>
    public void Activate(GameObject player)
    {
        cameraXform = this.transform;        //.parent;
        if (cameraXform == null)
        {
            Debug.LogError("Parent camera to empty GameObject.", this);
        }

        follow      = player.GetComponent <CharacterControllerLogic>();
        followXform = player.transform;

        lookDir    = followXform.forward;
        curLookDir = followXform.forward;

        barEffect = GetComponent <BarsEffect>();
        if (barEffect == null)
        {
            Debug.LogError("Attach a widescreen BarsEffect script to the camera.", this);
        }

        // Position and parent a GameObject where first person view should be
        firstPersonCamPos = new CameraPosition();
        firstPersonCamPos.Init
        (
            "First Person Camera",
            new Vector3(0.0f, 1.6f, 0.2f),
            new GameObject().transform,
            follow.transform
        );

        camState = startingState;

        // Intialize values to avoid having 0s
        characterOffset  = followXform.position + new Vector3(0f, distanceUp, 0f);
        distanceUpFree   = distanceUp;
        distanceAwayFree = distanceAway;
        savedRigToGoal   = RigToGoalDirection;

        if (!Active)
        {
            Active = true;
        }
    }
	/// <summary>
	/// Use this for initialization.
	/// </summary>
	void Start ()
	{
		cameraXform = this.transform;//.parent;
		if (cameraXform == null)
		{
			Debug.LogError("Parent camera to empty GameObject.", this);
		}
		
		follow = GameObject.FindWithTag("Player").GetComponent<CharacterControllerLogic>();
		followXform = GameObject.FindWithTag("Player").transform;
		
		lookDir = followXform.forward;
		curLookDir = followXform.forward;
		
		barEffect = GetComponent<BarsEffect>();
		if (barEffect == null)
		{
			Debug.LogError("Attach a widescreen BarsEffect script to the camera.", this);
		}
		
		// Position and parent a GameObject where first person view should be
		firstPersonCamPos = new CameraPosition();
		firstPersonCamPos.Init
			(
				"First Person Camera",
				new Vector3(0.0f, 1.6f, 0.2f),
				new GameObject().transform,
				follow.transform
			);	

		camState = startingState;

		// Intialize values to avoid having 0s
		characterOffset = followXform.position + new Vector3(0f, distanceUp, 0f);
		distanceUpFree = distanceUp;
		distanceAwayFree = distanceAway;
		savedRigToGoal = RigToGoalDirection;
	}
	/// <summary>
	/// Use this for initialization.
	/// </summary>
	void Start ()
	{
		parentRig = this.transform.parent;
		if (parentRig == null)
		{
			Debug.LogError("Parent camera to empty GameObject.", this);
		}
		
		follow = GameObject.FindWithTag("Player").GetComponent<CharacterControllerLogic>();
		followXform = GameObject.FindWithTag("Player").transform;
		
		lookDir = followXform.forward;
		curLookDir = followXform.forward;
		
		barEffect = GetComponent<BarsEffect>();
		if (barEffect == null)
		{
			Debug.LogError("Attach a widescreen BarsEffect script to the camera.", this);
		}
		
		// Position and parent a GameObject where first person view should be
		firstPersonCamPos = new CameraPosition();
		firstPersonCamPos.Init
			(
				"First Person Camera",
				new Vector3(0.0f, 1.6f, 0.2f),
				new GameObject().transform,
				follow.transform
			);	
	}
    // Use this for initialization
    void Start()
    {
        characterMovement = GameObject.FindWithTag ("Player").GetComponent<CharacterMovement> ();
        characterFollower = GameObject.FindWithTag ("Player").transform;

        firstPersonCameraPosition = new CameraPosition ();
        firstPersonCameraPosition.Init (
            "First Person Camera",
            new Vector3 (0f, 1.7f, 0.5f),
            new GameObject ().transform,
            characterFollower
        );
    }
    // Use this for initialization
    /*void Awake(){
        var fadeTexture = new Texture2D(1,1);
        fadeTexture.Resize(400,400);
        fadeTexture.SetPixel(0,0,Color.black);
        fadeTexture.Apply();

        fade = new GameObject("Effect");
        fade.AddComponent<GUITexture>();
        fade.transform.position = new Vector3(0.5f, 0.5f, 1000f);
        fade.guiTexture.texture = wSBars;
        fade.guiTexture.texture.height=200;
        //wSBars.enabled = false;
    }*/
    void Start()
    {
        follow = GameObject.FindWithTag ("Player").GetComponent<OrbitalCharacterControllerLogic>();
        followTarget = GameObject.FindWithTag ("camTarget").transform;
        lookDir = followTarget.forward;
        curLookDir = followTarget.forward;

        /*	barEffect = GetComponent<BarsEffect>();
        if(barEffect == null){
            Debug.LogError("Attach a widescreen BarsEffect script to the camera.", this);
        }*/
        firstPersonCamPos = new CameraPosition();
        firstPersonCamPos.Init(
            "First Person Camera",
            new Vector3(0.0f, 0.004f, 0.005f),
            new GameObject().transform,
            followTarget
        );
    }
    // Use this for initialization
    void Start()
    {
        follow = GameObject.FindGameObjectWithTag("Player").GetComponent<CharacterControllerLogic>();
        followXForm = GameObject.FindGameObjectWithTag("Player").transform;
        lookDir = followXForm.forward;

        barEffect = GetComponent<BarsEffect>();

        // position and parent a GameObject where first person view should be
        firstPersonCamPos = new CameraPosition();
        firstPersonCamPos.Init("First Person Camera", new Vector3(0f, 0.1f, 0.2f), new GameObject().transform, followXForm);
    }