private void Start() { _inputController = (Joystick)StaticContainer.Get(typeof(Joystick)); _animator = GetComponent <IAnimator>(); _aimingController = (AimingController)StaticContainer.Get(typeof(AimingController)); SetState(_states.First(x => x.Name == GamePersonState.Idle)); }
public static void StaticInstantiation() { StaticContainer.Instantiate(); StaticContainer.BindNewInstance <Weapon, HeroDefaultWeapon>(); StaticContainer.BindNewInstance <Armor, HeroDefaultArmor>(); StaticContainer.BindNewInstance <Character, Hero>(); Hero hero = (Hero)StaticContainer.Get <Character>("hero"); Console.WriteLine(string.Format("This hero has weapon with atk = {0} and armor with def = {1}.", hero.Weapon.Atk, hero.Armor.Def)); StaticContainer.Dispose(); }
public void CanGet() { TestEmptyClass defaultSingleton = StaticContainer.Get <TestEmptyClass>(); Assert.AreSame(DEFAULT_EMPTY_CLASS, defaultSingleton); TestEmptyClass customSingleton = StaticContainer.Get <TestEmptyClass>(CUSTOM_ID); Assert.AreSame(CUSTOM_EMPTY_CLASS, customSingleton); TestEmptyClass prototype = StaticContainer.Get <TestEmptyClass>(PROTOTYPE_ID); Assert.AreNotSame(PROTOTYPE_EMPTY_CLASS, prototype); Assert.AreEqual(typeof(TestEmptyClass), prototype.GetType()); TestEmptyChildClass childClass = (TestEmptyChildClass)StaticContainer.Get <TestEmptyClass>(SUBCLASS_ID); Assert.AreSame(EMPTY_CHILD_CLASS, childClass); }
private void Start() { _aimingController = (AimingController)StaticContainer.Get(typeof(AimingController)); _animator = GetComponent <IAnimator>(); }
private void Start() { _aimingController = (AimingController)StaticContainer.Get(typeof(AimingController)); }
private void Start() { _inputController = (Joystick)StaticContainer.Get(typeof(Joystick)); _animator = GetComponent <IAnimator>(); _direction = Vector3.zero; }
private void Start() { _cameraControl = (CameraControl)StaticContainer.Get(typeof(CameraControl)); _cameraControl.SetTarget(_player.transform); }