Exemple #1
0
        public virtual void Awake()
        {
            Debug.Log("Base Scene Controller Awake");

            MessageInterface = new QdmsMessageInterface(this.gameObject);
            MessageInterface.SubscribeReceiver((m) => HandleMessage(m));

            Current = this;
            if (AutoinitUi)
            {
                InitUI();
            }
            if (AutoinitHud)
            {
                InitHUD();
            }

            //mostly an editor hack
            if (AutoinitState && !GameState.Instance.InitialLoaded)
            {
                GameState.LoadInitial();
            }
        }
Exemple #2
0
 private void Start()
 {
     MessageInterface = new QdmsMessageInterface(this.gameObject);
     MessageInterface.SubscribeReceiver(HandleMessageReceived);
     SetStateFromConfig();
 }
 private void Awake()
 {
     MessageInterface = new QdmsMessageInterface(this.gameObject);
     MessageInterface.SubscribeReceiver(HandleMessage);
 }
Exemple #4
0
 private void Awake()
 {
     MessageInterface = new QdmsMessageInterface(this);
     Current          = this;
 }
Exemple #5
0
        public override void Start()
        {
            base.Start();

            Debug.Log("Player controller start");

            if (!CameraRoot)
            {
                CameraRoot = transform.Find("CameraRoot");
            }

            if (!ModelRoot)
            {
                ModelRoot = transform.GetChild(0).gameObject;
            }

            if (!MovementComponent)
            {
                MovementComponent = GetComponent <PlayerMovementComponent>();
            }

            if (!WeaponComponent)
            {
                WeaponComponent = GetComponentInChildren <PlayerWeaponComponent>();
            }

            if (!CameraZoomComponent)
            {
                CameraZoomComponent = GetComponentInChildren <PlayerCameraZoomComponent>(true);
            }

            if (!DeathComponent)
            {
                DeathComponent = GetComponentInChildren <PlayerDeathComponent>();
            }

            if (!ShieldComponent)
            {
                ShieldComponent = GetComponent <PlayerShieldComponent>();
            }

            if (!HUDScript)
            {
                HUDScript = (RpgHUDController)BaseHUDController.Current; //I would not recommend this cast
            }

            if (!HUDScript && AutoinitHud)
            {
                Instantiate <GameObject>(CoreUtils.LoadResource <GameObject>("UI/DefaultWorldHUD"), CoreUtils.GetUIRoot());
                if (EventSystem.current == null)
                {
                    Instantiate(CoreUtils.LoadResource <GameObject>("UI/DefaultEventSystem"));
                }

                HUDScript = (RpgHUDController)BaseHUDController.Current;
            }

            MessageInterface = new QdmsMessageInterface(gameObject);

            LockPauseModule.CaptureMouse = true;

            SetDefaultPlayerView();
            SetInitialViewModels();

            ShieldComponent.Ref()?.HandleLoadStart();
        }
Exemple #6
0
 private void Awake()
 {
     MessageInterface = new QdmsMessageInterface(gameObject);
     MessageInterface.KeepMessagesInQueue = false;
     MessageInterface.SubscribeReceiver(HandleMessageReceived);
 }
Exemple #7
0
        public override void Start()
        {
            base.Start();

            Debug.Log("Player controller start");

            if (!CameraRoot)
            {
                CameraRoot = transform.Find("CameraRoot");
            }

            if (!ModelRoot)
            {
                ModelRoot = transform.GetChild(0).gameObject;
            }

            if (!MovementComponent)
            {
                MovementComponent = GetComponent <PlayerMovementComponent>();
            }

            if (!WeaponComponent)
            {
                WeaponComponent = GetComponentInChildren <PlayerWeaponComponent>();
            }

            if (!CameraZoomComponent)
            {
                CameraZoomComponent = GetComponentInChildren <PlayerCameraZoomComponent>(true);
            }

            if (!DeathComponent)
            {
                DeathComponent = GetComponentInChildren <PlayerDeathComponent>();
            }

            if (!ShieldComponent)
            {
                ShieldComponent = GetComponent <PlayerShieldComponent>();
            }

            if (LightReportingComponent == null)
            {
                LightReportingComponent = GetComponentInChildren <IReportLight>() as MonoBehaviour;
            }

            if (!HUDScript)
            {
                HUDScript = SharedUtils.TryGetHudController() as RpgHUDController;
            }

            if (!HUDScript && AutoinitHud)
            {
                Instantiate <GameObject>(CoreUtils.LoadResource <GameObject>("UI/DefaultWorldHUD"), CoreUtils.GetUIRoot());
                if (EventSystem.current == null)
                {
                    Instantiate(CoreUtils.LoadResource <GameObject>("UI/DefaultEventSystem"));
                }

                HUDScript = SharedUtils.TryGetHudController() as RpgHUDController;
                if (HUDScript == null)
                {
                    Debug.LogError("[PlayerController] Failed to initialize HUD properly");
                }
            }

            MessageInterface = new QdmsMessageInterface(gameObject);

            LockPauseModule.CaptureMouse = true;

            SetDefaultPlayerView();
            SetInitialViewModels();

            ShieldComponent.Ref()?.HandleLoadStart();

            TryExecuteOnComponents(component => component.Init(this));
            Initialized = true;
        }