public SpaceshipInitialization(ISpaceshipFactory spaceshipFactory, HealthKeeper health) { _spaceshipFactory = spaceshipFactory; _spaceship = _spaceshipFactory.CreateSpaceship(); _spaceship.AddComponent <TrackingSpaceshipContacts>(); _health = health; _contacts = _spaceship.GetComponent <TrackingSpaceshipContacts>(); _contacts.SpaceshipCollisionHappend += _health.DetermineContact; }
private void Awake() { var spaceshipFactory = new SpaceshipFactory(_data.SpaceshipData); var healthKeeper = new HealthKeeper(_data.SpaceshipData); _spaceshipInitialization = new SpaceshipInitialization(spaceshipFactory, healthKeeper); _camera = new GameCamera(_spaceshipInitialization.GetTransform()); var space = new World(_spaceshipInitialization.GetTransform(), _data.SpaceshipData); space.CreateWorld(); _movementInitialization = new MovementInitialization(_spaceshipInitialization.GetTransform(), _data.SpaceshipData, _camera.WorldPosition); _attackInitialization = new AttackInitialization(_spaceshipInitialization.GetTransform(), _data.SpaceshipData, _data.BulletData); _enemyPoolInitialization = new EnemyPoolInitialization(_data.EnemyData, _spaceshipInitialization.GetTransform()); }