private void InstallWithUnwalkableCollider(Vector2 spawnerBoxColliderSize, out BoxCollider2D unwalkableCollider)
        {
            var unwalkableLayerMask = LayerMask.NameToLayer("Unwalkable");

            _spawnerGameObject            = new GameObject("Pickups Spawner");
            _spawnerBoxCollider           = _spawnerGameObject.AddComponent <BoxCollider2D>();
            _spawnerBoxCollider.size      = spawnerBoxColliderSize;
            _spawnerBoxCollider.isTrigger = true;
            _pickupsSpawner = _spawnerGameObject.AddComponent <PickupsSpawner>();
            SetItemBlockLayerField(unwalkableLayerMask);

            var unwalkableGameObject = new GameObject("Unwalkable Layer")
            {
                layer = unwalkableLayerMask
            };

            unwalkableCollider = unwalkableGameObject.AddComponent <BoxCollider2D>();

            var pickups = new GameObject("Factory");

            pickups.AddComponent <BoxCollider2D>();

            PreInstall();

            Container.BindFactory <Pickups, Pickups.Factory>().To <AmmoPickups>().FromNewComponentOn(pickups);

            PostInstall();
        }
Exemplo n.º 2
0
 // Start is called before the first frame update
 void Start()
 {
     enemyCount = count;
     for (int i = 0; i < enemyCount; i++)
     {
         PickupsSpawner.SpawnRandom(enemyPrefab, this.transform);
     }
 }
 private void SetupPickupsSpawner()
 {
     _spawnerGameObject            = new GameObject();
     _spawnerBoxCollider           = _spawnerGameObject.AddComponent <BoxCollider2D>();
     _spawnerBoxCollider.isTrigger = true;
     _pickupsSpawner = _spawnerGameObject.AddComponent <PickupsSpawner>();
     SetItemBlockLayerField(LayerMask.NameToLayer("Unwalkable"));
 }