예제 #1
0
    //Get components
    protected override void Start()
    {
        base.Start();

        //These will always work
        playerController = GetComponent <PlayerController>();
        playerInput      = GetComponent <PlayerInput>();

        //May possibly evaluate to null
        gunManager = GetComponent <GunManager>();
        mouseLook  = GetComponentInChildren <MouseLook>();
        headBobber = GetComponentInChildren <HeadBob>();

        //Attach the gun to the hand
        if (gunManager != null)
        {
            gunManager.EquipWeapon(startingWeapon);
        }

        normalSpeed  = playerController.moveSpeed;
        walkingSpeed = normalSpeed * 0.1f;
    }