void Awake()
 {
     _movementControl = this.GetComponent <IMovementController>();
     _weaponSystem    = this.GetComponent <IWeaponSystem>();
     _weaponFire      = this.GetComponent <IWeaponFire>();
     _cameraControl   = this.GetComponent <ICameraControl>();
 }
    //************
    //**  MONO  **
    //************

    void Start()
    {
        mDefaultDirection = new Vector2(0, 1);
        mGunHinge         = transform.GetChild(0);
        mMovementHandler  = GetComponent <IMoveable>();
        mHealthManager    = GetComponent <IHealthManager>();
        mInventory        = GetComponent <IInventory>();
        mWeaponHandler    = GetComponent <IWeaponSystem>();
        mAudioSource      = GetComponent <AudioSource>();
    }
        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();
        }
Example #4
0
 void DealWeapon(IWeaponSystem weaponSystem)
 {
     weaponSystem.SetWeapon(_weaponDealSelector.GetWeapon());
     SetEnable(false);
 }
Example #5
0
 // Start is called before the first frame update
 void Start()
 {
     WeaponSystem = new WeaponSystem();
 }
 public override void Init(StatHandler statHandler, PowerupSystem system, float lifeTime)
 {
     this.statHandler = statHandler;
     this.lifeTime    = lifeTime;
     weaponSystem     = system.GetComponent <IWeaponSystem>();
 }