コード例 #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();
        }
コード例 #2
0
    /// <summary>
    /// Funzione che inizializza lo script
    /// </summary>
    public void Init(EnemyManager _enemyMng, PlatformManager _platformMng, TokenManager _tokenMng)
    {
        //Prendo le referenze ai component e li inizializzo
        collisionCtrl = GetComponent <PlayerCollisionController>();
        if (collisionCtrl != null)
        {
            collisionCtrl.Init(this);
        }

        shootCtrl = GetComponent <PlayerShotController>();
        if (shootCtrl != null)
        {
            shootCtrl.Init(this, PoolManager.instance);
        }

        movementCtrl = GetComponent <PlayerMovementController>();
        if (movementCtrl != null)
        {
            movementCtrl.Init(this, collisionCtrl);
        }

        parasiteCtrl = GetComponent <PlayerParasiteController>();
        if (parasiteCtrl != null)
        {
            parasiteCtrl.Init(this, _enemyMng, _platformMng);
        }

        healthCtrl = GetComponent <PlayerHealthController>();
        if (healthCtrl != null)
        {
            healthCtrl.Init(this);
        }

        livesCtrl = GetComponent <PlayerLivesController>();
        if (livesCtrl != null)
        {
            livesCtrl.Init(this, _tokenMng);
        }

        playerSM = GetComponent <PlayerSMController>();
        if (playerSM != null)
        {
            playerSM.Init(this);
        }

        animCtrl = GetComponentInChildren <PlayerAnimationController>();
        if (animCtrl != null)
        {
            animCtrl.Init(this);
        }

        vfxCtrl = GetComponentInChildren <PlayerVFXController>();
        if (vfxCtrl != null)
        {
            vfxCtrl.Init(this);
        }

        sfxCtrl = GetComponentInChildren <PlayerSoundController>();
        if (sfxCtrl != null)
        {
            sfxCtrl.Setup(this);
            sfxCtrl.Init();
        }

        //Setup cose locali
        playerGraphic = GetComponentInChildren <PlayerGraphicController>();
        if (playerGraphic != null)
        {
            activeGraphic = playerGraphic;
            playerGraphic.OnModelChanged += HandleOnPlayerModeloChanged;
            playerGraphic.Init();
        }

        spriteCtrl = GetComponentInChildren <PlayerSpriteController>();
        if (spriteCtrl != null)
        {
            spriteCtrl.Init(this);
        }
    }