Skip to content

Instantly share code, notes, and snippets.

@daleth90
Created Jul 26, 2017
Embed
What would you like to do?
shooting example
using UnityEngine;
using Zenject;
public class GameInstaller : MonoInstaller<GameInstaller> {
[SerializeField]
private Hero heroPrefab;
[SerializeField]
private Bullet bulletPrefab;
public override void InstallBindings() {
Container.BindInterfacesAndSelfTo<Game>().AsSingle();
Container.Bind<Hero>().FromComponentInNewPrefab( heroPrefab ).AsSingle();
Container.Bind<Armony>().AsSingle();
Container.Bind<Weapon>().To<Rifle>().AsSingle();
Container.Bind<Weapon>().To<TripleRifle>().AsSingle();
Container.Bind<BulletPool>().AsSingle();
Container.Bind<Bullet>().FromInstance( bulletPrefab ).AsSingle();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment