protected void Start()
    {
        // Cache component references
        _characterController = GetComponent <CharacterController>();
        _controllerHeight    = _characterController.height;

        // Get the main camera and cache local position within the FPS rig
        _camera = Camera.main;
        _localSpaceCameraPos = _camera.transform.localPosition;

        // Set initial to not jumping and not moving
        _movementStatus = PlayerMoveStatus.NotMoving;

        // Reset timers
        _fallingTimer = 0.0f;

        // Setup Mouse Look Script
        _mouseLook.Init(transform, _camera.transform);

        // Initiate Head Bob Object
        _headBob.Initialize();
        _headBob.RegisterEventCallback(1.5f, PlayFootStepSound, CurveControlledBobCallbackType.Vertical);

        if (_flashLight)
        {
            _flashLight.SetActive(false);
        }
    }
Exemplo n.º 2
0
    protected void Start()
    {
        _characterController = GetComponent <CharacterController>();
        _controllerHeight    = _characterController.height;
        _camera = Camera.main;
        _localSpaceCameraPos = _camera.transform.localPosition;
        _movementStatus      = PlayerMoveStatus.NotMoving;
        _fallingTimer        = 0.0f;
        //初始化MouseLook脚本
        _mouseLook.Init(transform, _camera.transform);
        _headBob.Initialize();
        _headBob.RegisterEventCallback(1.5f, PlayFootStepSound, CurveControlledBobCallbackType.Vertical);

        if (_flashLight)
        {
            _flashLight.SetActive(false);
        }
    }
Exemplo n.º 3
0
    void Start()
    {
        _characterController = GetComponent <CharacterController>();
        _camera = Camera.main;

        // Setup mouse look script
        _mouseLook.Init(transform, _camera.transform);

        _localSpaceCameraPos = _camera.transform.localPosition;
        _headBob.Initialize();
        _headBob.RegisterEventCallback(1.5f, PlayerFootStepSound, CurveControlledBobCallbackType.Vertical);

        if (_flashLight)
        {
            _flashLight.SetActive(_flashLightOnAtStart);
        }

        _characterControllerHeight = _characterController.height;
    }
Exemplo n.º 4
0
    //functions

    protected void Start()
    {
        _characterController = GetComponent <CharacterController>();
        _controllerHeight    = _characterController.height;

        //searches for camera with main camera tag
        _camera = Camera.main;
        _localSpaceCameraPos = _camera.transform.localPosition;
        print(_localSpaceCameraPos);

        _movementStatus = PlayerMoveStatus.NOTMOVING;

        _fallingTimer = 0.0f;

        _mouseLook.Init(transform, _camera.transform);

        _headBob.Initialize();
        _headBob.RegisterEventCallback(1.5f, PlayFootstepSound, CurveControlledBobCallbackType.VERTICAL);

        if (_flashLight)
        {
            _flashLight.SetActive(false);
        }
    }
    protected void Start()
    {
        // component references
        characterController = GetComponent <CharacterController>();
        controllerHeight    = characterController.height;

        // Get the main camera and save its local position within the FPS rig
        _camera             = Camera.main;
        localSpaceCameraPos = _camera.transform.localPosition; //every frame can generate offset frm this vector, so now rounding errors

        // Set movementStatus to not jumping and not moving
        movementStatus = PlayerMoveStatus.NotMoving;

        // Reset timers
        fallingTimer = 0.0f;

        // Setup Mouse Look Script. Uses MouseLook script thats already available.
        mouseLook.Init(transform, _camera.transform);

        // Initiate Head Bob Object
        headBob.Initialize();
        //Plays footstep sound when YplayHead passes the 1.5 second mark
        headBob.RegisterEventCallback(1.5f, PlayFootStepSound, CurveControlledBobCallbackType.Vertical);

        //Make sure the game starts wuth flashlight set to inactive
        if (flashLight)
        {
            flashLight.SetActive(false);
        }

        //All sprites in inventory set to inactive
        m4Sprite.enabled      = false;
        shotgunSprite.enabled = false;
        keySprite.enabled     = false;
        endKeySprite.enabled  = false;
    }