Esempio n. 1
0
        public override void Init()
        {
            movementController    = GetComponent <PlayerMovementController>();
            actionController      = GetComponent <PlayerActionController>();
            rotationController    = GetComponent <PlayerRotationController>();
            animationController   = GetComponent <PlayerAnimationController>();
            inventoryController   = GetComponent <PlayerInventoryController>();
            weaponController      = GetComponent <PlayerWeaponController>();
            healthController      = GetComponent <HealthController>();
            reloadController      = GetComponent <PlayerReloadController>();
            interactionController = GetComponent <InteractionSearcherController>();
            executionController   = GetComponent <PlayerExecutionController>();
            limbsController       = GetComponentInChildren <LimbsController>();
            hitboxController      = GetComponentInChildren <HitboxController>();
            abilityController     = GetComponent <AbilityController>();

            tickPlayer.value = true;

            movementController.Init();
            actionController.Init();
            rotationController.Init();
            animationController.Init();
            weaponController.Init();
            inventoryController.Init();
            healthController.Init();
            reloadController.Init();
            interactionController.Init();
            executionController.Init();
            limbsController.Init();
            hitboxController.Init();
            abilityController.Init();
        }
        public override void Init()
        {
            weaponController       = GetComponent <PlayerWeaponController>();
            playerHealthController = GetComponent <HealthControllerPlayer>();
            reloadController       = GetComponent <PlayerReloadController>();

            playerMeleeWeaponLayerMask = Resources.Load("LayerMasks/LayerMask_Player Melee Weapon") as ScriptableLayerMask;
            throwWeaponInputAction     = Resources.Load("Input Actions/Input Action Throw Weapon") as ScriptableInputBoolAction;
            toggleWeaponInputAction    = Resources.Load("Input Actions/Input Action Toggle Weapon") as ScriptableInputBoolAction;

            isPlayerReloading = Resources.Load("Player/PlayerIsReloading") as ScriptableBool;

            searcherController          = GetComponent <InteractionSearcherController>();
            worldInteractionParentGroup = FindObjectOfType <WorldInteractionsManager>().transform;
            playerRightHand             = GetComponentInChildren <RightHandIdentifier>().transform;

            inventoryAmmo.rifleAmmo     = playerInventoryData.inventoryAmmo.rifleAmmo;
            inventoryAmmo.pistolAmmo    = playerInventoryData.inventoryAmmo.pistolAmmo;
            inventoryAmmo.shotgunShells = playerInventoryData.inventoryAmmo.shotgunShells;
            inventoryAmmo.arrows        = playerInventoryData.inventoryAmmo.arrows;

            fistsWeaponRuntime.FreshSpawnWeapon();
            fistsWeaponRuntime.PickupWeaponPlayer();
            fistsWeaponRuntime.DisableAttackColliders();

            SpawnInventoryWeapons(playerInventoryData.inventoryWeapons);
        }