void Start() { Debug.Log("Parent: " + Parent); Debug.Log("Child: " + child); Debug.Log("Sibling Component: " + siblingComponent); Debug.Log("Canvas: " + canvas); Debug.Log("SettingsManager: " + SettingsManager); Debug.Log("Settings: " + settings); Debug.Log("Author: " + NameOfAuthor); Debug.Log("Field from method injection:" + methodInjectionField); Debug.Log("Instance of an interface (field 1):" + demoInterfaceInstance1.GetGreeting()); Debug.Log("Instance of an interface (field 2):" + demoInterfaceInstance2.GetGreeting()); Debug.Log("Instance of an interface with constructor parameters:" + demoInterfaceInstanceWithConstructorParameters.GetByeBye()); Debug.Log("Optional sceneNavigator: " + sceneNavigator); Debug.Log("Optional uiText: " + uiText); Debug.Log("The bound int: " + SceneInjector.GetValueForInjectionKey <int>()); Debug.Log("The bound instance of an interface: " + SceneInjector.GetValueForInjectionKey <IDependencyInjectionDemoInterface>()); Debug.Log("Injector:" + injector); }
public void SetUp() { DependencyContainer.Instance.Reset(); gameObjects = new GameObject[numInjectees + 2]; injectees = new MockInjectee[numInjectees]; stringDependency = new MockDependency <string>(STRING); intDependency = new MockDependency <int>(INT); for (int i = 0; i < numInjectees + 1; i++) { gameObjects[i] = new GameObject(); if (i == 0) { provider = gameObjects[i].AddComponent <MockProvider>(); provider.stringProvider = stringDependency; provider.intProvider = intDependency; } else { injectees[i - 1] = gameObjects[i].AddComponent <MockInjectee>(); } } injector = provider.gameObject.AddComponent <SceneInjector>(); }
//in the future, take twists. public GameObject SpawnEnemy(SceneInjector inject, RoomManager _in) { Gfx.SetActive(false); GameObject nuMeat = Instantiate(EnemyPrefab, this.transform.position, this.transform.rotation); BaseEnemy EnScript = nuMeat.GetComponent <BaseEnemy>(); EnScript.AddInject(inject); EnScript.AttachManager(_in); //Debug.Log("EnemSpawn: Spawnered: " + nuMeat.name); nuMeat.transform.SetParent(_in.gameObject.transform); return(nuMeat); }
public void InstantiatePlayer(SceneInjector passject, Transform incam) { sceneject = passject; MainCam = incam; //Input playerInput = new PlayerControls(); //playerInput.Debug.DieBind.performed += _ => PlayerDeath(); playerInput.Debug.DBGdmg.performed += _ => DebugModify(); playerInput.MovementMK.Interact.performed += _ => Interact(); playerInput.MovementMK.Reset.performed += ctx => Quit(); //DEBUG: originally in onenable, but the spawn method is a little odd to be sure. playerInput.Enable(); //Injection //sceneject.SceneJect += Injection; //sceneject.FixedSceneLoad += PlayerStart; LM = sceneject.Request <LevelManagement>(); pooler = sceneject.Request <Pooler>(); debugManager = sceneject.Request <DebugManager>(); //DEBUG: input state set, just for now. Eventually, legitimate start. inputState = InputState.Move; //Stats Subscription playerstat = this.GetComponent <StatsManager>(); //get player stats playerstat.onDeath += PlayerDeath; playerstat.HealthUpdate += UpdateHealth; playerstat.StatUpdate += UpdateStats; //load local. playerMove = this.GetComponent <ThirdPersonMovement>(); playerstat = this.GetComponent <StatsManager>(); playercomb = this.GetComponent <PlayerCombat>(); playerload = this.GetComponent <PlayerLoadout>(); PlayerStart(); }
//TEMP: basically, spawn, with new start based on Room Manager. public void AddInject(SceneInjector _in) { sceneject = _in; _pool = sceneject.Request <Pooler>(); EnemyStart(); }
private void AttachSceneject(SceneInjector _sceneject) { sceneject = _sceneject; }
//main thing, to pass in injections. Otherwise, track # of enemies in area, and rewards. //box collider //rewards public void StartRoom(SceneInjector _in) { AttachSceneject(_in); InjectEnemies(); }