Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        stateMachine = new StateMachine();

        if (CameraObj != null)
        {
            camController = CameraObj.GetComponent <ThirdPersonCamera>();
        }
        else
        {
            camController = Camera.main.GetComponent <ThirdPersonCamera>();
        }

        camController.SetTarget(Ref_CamDefault.transform);
        camController.SetTargetCameraPos(defCamDist, defOffset);
        //camController.camTargetRef = Ref_CamDefault.transform;
        //camController.camAimingTargetRef = Ref_CamAiming.transform;

        probeController = Probe.GetComponent <ProbeBehavior>();
        charController  = GetComponent <CharacterController>();
        animator        = GetComponent <Animator>();
        dogBehaviour    = AIDogo.GetComponent <DogBehavior>();
        pickupBehaviour = ThrowingDogo.GetComponent <PickupBehavior>();
        Sound_bark      = GetComponent <AudioSource>();


        // Give stateMachine a state so that coroutine StateSwitch has something
        // to compare with
        stateMachine.ChangeState(new DefaultPlayer(this, animator));

        StartCoroutine(StateSwitch(stateMachine));
        StartCoroutine(DogSwitcher());

        Cursor.lockState = CursorLockMode.Locked;
    }