Example #1
0
    /// <summary>
    /// Retrieves and intiialises the weapon system attached on the ship.
    /// </summary>
    void SetWeaponSystems(VesselShipStats vesselStats, SceneController sceneController)
    {
        IWeaponSystem weaponSystem;

        weaponSystem = this.GetComponent <IWeaponSystem>();
        weaponSystem.Init(GetObjectID(), this, true, vesselStats, sceneController);

        //Load weapon/damage components.
        FighterDamageManager damageSystem = this.GetComponent <FighterDamageManager>();

        damageSystem.Init(statHandler, audioSystem);
    }
        public override void Init(SpawnManager spawner, TeamColor teamColor)
        {
            base.Init(spawner, teamColor);

            GameManager     gameManager     = GameManager.Instance;
            SceneController sceneController = gameManager.sceneController;

            if (playerState == null)
            {
                playerState = this.gameObject.AddComponent <PlayerStateManager>();
            }
            audioSystem = this.GetComponent <VesselAudioSystem>();
            audioSystem.Init(EntityType.Player);
            audioSystem.PlayFlightAudio(vesselSelection);
            PlayerSettings playerSettings = gameManager.gameSettings.playerSettings;

            //Initialise Stat Handler
            GameSettings    gameSettings = gameManager.gameSettings;
            VesselShipStats vesselStats  = gameSettings.vesselStats.Where(x => x.type == vesselSelection).First();
            BaseStats       playerStats  = vesselStats.baseShipStats;

            statHandler = new StatHandler(playerStats, EntityType.Player, this);

            //Initialize Health Component
            HealthComponent healthComponent = this.GetComponent <HealthComponent>();

            healthComponent.Init(statHandler, sceneController);

            //Initialise Weapon System
            IWeaponSystem weaponSystem = this.GetComponent <IWeaponSystem>();

            weaponSystem.Init(GetObjectID(), this, false, vesselStats, sceneController);

            //Initializes the player's camera system
            cameraController = this.GetComponent <CameraController>();
            cameraController.Init(virtualCamera, vesselSelection);

            //Load weapon/damage components.
            FighterDamageManager damageManager = this.GetComponent <FighterDamageManager>();

            damageManager.Init(statHandler, audioSystem);

            //Load Movement Manager
            MovementRegister movementRegister = this.GetComponent <MovementRegister>();

            Debug.Log(movementRegister);
            movementRegister.Init(this, cameraController);

            SetInitalState();
        }