public BlueMDownMovingState(BlueM bluem, IEnemyFactory factory) { die = false; this.BlueM = bluem; this.factory = factory; GetSprite = new GeneralSprite(96, 96, 2); }
public Level1(IPlayer player) { backgroundTexture = new Texture(Resources.LevelBG); background = new Sprite(backgroundTexture) { Scale = new Vector2f(WindowProperties.ScaleX, WindowProperties.ScaleY) }; this.player = player; mousePointer = new MousePointer(); enemyFactory = new EnemyFactory(); enemies = new List <IEnemy>(); enemyBullets = new List <Bullet>(); explosionFactory = new ExplosionFactory(); explosions = new List <Explosion>(); levelClock = new Clock(); digitalClockFont = new Font(Resources.FontDigitalClock); digitalClock = new Text("", digitalClockFont, 30) { Position = new Vector2f(WindowProperties.WindowWidth * 30 / 32, WindowProperties.WindowHeight * 30 / 32), Color = new Color(Color.White) }; backgroundMusic = new Music(Resources.LevelBGMusic) { Loop = true }; backgroundMusic.Play(); }
public EnemyArrow(Vector2 Position, Vector2 direction, IEnemyFactory factory) { MovingSpeed = 40; this.Position = Position + new Vector2(30, 30); Direction = direction; damaging = false; timer = 0; exist = true; if (Direction.X == (float)1) { GetSprite = new GeneralSprite(20, 50, 1); } else if (Direction.X == (float)-1) { GetSprite = new GeneralSprite(20, 50, 1); } else if (Direction.Y == (float)1) { GetSprite = new GeneralSprite(50, 20, 1); } else if (Direction.Y == (float)-1) { GetSprite = new GeneralSprite(50, 20, 1); } }
public BlueOctLeftMovingState(BlueOct blueoct, IEnemyFactory factory) { die = false; this.BlueOct = blueoct; this.factory = factory; GetSprite = new GeneralSprite(96, 96, 2); }
private void Start() { _player = FindObjectOfType <Player>(); _inputController = new InputController(FindObjectOfType <Player>()); _objectPooler = new ObjectPooler(); _shootingController = new ShootingController(_objectPooler); _enemyFactory = new EnemyAsteroidsFactory(_listOfEnemyScriptableObjects); //Цикл временно тут, спавнит астероиды для проверки работы for (int i = 0; i <= _enemyCount; i++) { _enemyFactory.GetEnemy(); } _interactiveObjects = FindObjectsOfType <InteractiveObject>(); _bullets = FindObjectsOfType <Bullet>().ToList(); _listOfExecutables = new ListOfExecutables(); _listOfExecutables.AddExecutableObject(_player); _listOfExecutables.AddExecutableObject(_inputController); _listOfExecutables.AddExecutableObject(_shootingController); foreach (var VARIABLE in _bullets) { _listOfExecutables.AddExecutableObject(VARIABLE); } }
public OctUpMovingState(Oct oct, IEnemyFactory factory) { die = false; this.Oct = oct; this.factory = factory; GetSprite = new GeneralSprite(96, 96, 2); }
public LevelLoader(IEnemyFactory enemyFactory, MainStage game) { this.game = game; LevelXml = new XmlDocument(); this.enemyFactory = enemyFactory; LevelXml.Load(@"../../../../LevelRooms.xml"); }
public AquamentusLeftMovingState(Aquamentus Aquamentus, IEnemyFactory factory) { die = false; this.Aquamentus = Aquamentus; this.factory = factory; GetSprite = new GeneralSprite(150, 204, 4); }
public RedBatRightMovingState(RedBat redBat, IEnemyFactory factory) { die = false; this.RedBat = redBat; this.factory = factory; GetSprite = new GeneralSprite(96, 96, 2); }
public BlueGoriyaRightMovingState(BlueGoriya Bluegoriya, IEnemyFactory factory) { die = false; this.BlueGoriya = Bluegoriya; this.factory = factory; GetSprite = new GeneralSprite(96, 96, 2); }
public RedGoriyaLeftMovingState(RedGoriya redgoriya, IEnemyFactory factory) { die = false; this.RedGoriya = redgoriya; this.factory = factory; GetSprite = new GeneralSprite(96, 96, 2); }
public Aquamentus(Vector2 position, Vector2 direction, IEnemyFactory factory) { State = new AquamentusLeftMovingState(this, factory); this.Position = position; exist = true; MovingSpeed = 1; rand = new Random(); }
public BlueBatDownMovingState(BlueBat BlueBat, IEnemyFactory factory) { die = false; this.BlueBat = BlueBat; this.factory = factory; GetSprite = new GeneralSprite(96, 96, 2); }
static void Main(string[] args) { IEnemyFactory enemyFactory = LoadFactory(); IEnemy enemy = enemyFactory.CreateEnemy(); enemy.Attack(); enemy.Die(); }
public GameModel(IEnemyFactory enemyFactory, GameFieldSize gameFieldSize, Dictionary <PlayerState, GameObjectSize> playerSizesByStates) { Console.WriteLine($"Starting game with field {gameFieldSize.Width}x{gameFieldSize.Height} size"); this.enemyFactory = enemyFactory; this.gameFieldSize = gameFieldSize; this.playerSizesByStates = playerSizesByStates; Reset(); State.PlayerAlive = false; }
public BlueGoriya(Vector2 position, Vector2 direction, IEnemyFactory factory) { State = new BlueGoriyaLeftMovingState(this, factory); this.Position = position; MovingSpeed = 1; exist = true; rand = new Random(); damaging = false; timer = 0; }
public BlueM(Vector2 Position, Vector2 Direction, IEnemyFactory factory) { exist = true; State = new BlueMUpMovingState(this, factory); this.Position = Position; MovingSpeed = 1; rand = new Random(); damaging = false; timer = 0; }
public void Init(GameFieldInfo gameFieldInfo, IEnemyFactory enemyFactory) { this.gameFieldInfo = gameFieldInfo; this.enemyFactory = enemyFactory; spawnedEnemies = 0; spawnTime = maxSpawnTime; lastSpawnTime = Time.time; enemies = new List <EnemyView>(); Initialized = true; }
public RedGoriya(Vector2 Position, Vector2 Direction, IEnemyFactory factory) { State = new RedGoriyaUpMovingState(this, factory); this.Position = Position; rand = new Random(); MovingSpeed = 1; exist = true; damaging = false; timer = 0; }
public EnemyPool(int poolCapacity, EnemyData enemyData, IEnemyFactory factory) { _factory = factory; _enemyPool = new Dictionary <EnemyTypes, HashSet <BaseEnemyController> >(); _poolCapacity = poolCapacity; _enemyData = enemyData; if (!_poolRoot) { _poolRoot = new GameObject(ObjectNames.POOL_ASTEROIDS).transform; } }
void Awake() { radius = GetComponent<SphereCollider>().radius; pointers = new List<EnemyPointerWidget>(); registry = IOC.Resolve<IRegistryService>(); enemyFactory = IOC.Resolve<IEnemyFactory>(); enemyFactory.onEnemyCreated += OnEnemyCreated; }
public EnemyFireBall(Vector2 Position, Vector2 direction, IEnemyFactory factory) { MovingSpeed = 20; this.Position = Position + new Vector2(30, 30); Direction = direction; damaging = false; timer = 0; exist = true; GetSprite = new GeneralSprite(50, 50, 1); }
public EnemyInitialization(IEnemyFactory enemyFactory) { _enemyFactory = enemyFactory; _enemy = new CompositeMove(); var enemy = _enemyFactory.CreateEnemy(EnemyType.Small); _enemy.AddUnit(enemy); _enemies = new List <IEnemy> { enemy }; }
/// <summary> /// 敵生成ファクトリーを登録 /// </summary> /// <param name="kind"></param> /// <param name="factory"></param> public void RegisterEnemyFactory(EnemyKind kind, IEnemyFactory factory) { enemyFactories.Add(kind, factory); // コールバック用に種類を保持 EnemyKind enemyKind = kind; factory.AddSpawnListener( (createdEnemy) => { enemyList[enemyKind].Add(createdEnemy); }); }
public void SpawnEnemy(string enemy) { switch (enemy.ToLower()) { case "mage": spawner = new Mage(); Console.WriteLine("Появился новый враг - Маг\nОн снаряжен:"); break; case "warrior": spawner = new Warrior(); Console.WriteLine("Появился новый враг - Воин\nОн снаряжен:"); break; } Console.WriteLine(spawner.GetArmor().Item()); Console.WriteLine(spawner.GetWeapon().Item()); Console.WriteLine("___________________________________________________________"); }
public Engine(IUserInterface userInterface, ICollisionDispatcher collisionDispatcher, IRenderer renderer, Tank theTank, IEnemyFactory enemy, int sleepTimeInMs) { this.userInterface = userInterface; this.collisionDispatcher = collisionDispatcher; this.renderer = renderer; this.theTank = theTank; this.sleepTime = sleepTimeInMs; this.enemy = enemy; this.score = 0; this.lastLevelScore = 0; allObjects = new List <GameObject>(); allObjects.Add(theTank); }
public Engine(IUserInterface userInterface, ICollisionDispatcher collisionDispatcher, IRenderer renderer, Tank theTank, IEnemyFactory enemy, int sleepTimeInMs) { this.userInterface = userInterface; this.collisionDispatcher = collisionDispatcher; this.renderer = renderer; this.theTank = theTank; this.sleepTime = sleepTimeInMs; this.enemy = enemy; this.score = 0; this.lastLevelScore = 0; allObjects = new List<GameObject>(); allObjects.Add(theTank); }
public EnemySpawnController(CompositeMove enemies, IEnemyFactory enemyFactory, EnemyData data, Transform enemiesPlaceHolder, IEnemySpawnEvent enemySpawnEventHandler) { _enemiesMove = enemies; _data = data; _enemiesPlaceHolder = enemiesPlaceHolder; _enemyFactory = enemyFactory; _enemySpawnEventHandler = enemySpawnEventHandler; _enemiesPool = new EnemyProvider[_data.MaxEnemiesInPool]; }
protected override void LoadContent() { _container = AutofacConfig.Register(this); _spriteBatch = _container.Resolve <ISpriteBatch>(); _enemyFactory = _container.Resolve <IEnemyFactory>(); _player = _container.Resolve <IPlayer>(); var contentManager = _container.Resolve <IContentManager>(); var parallaxingBackgroundFactory = _container.Resolve <IParallaxingBackgroundFactory>(); _background1 = parallaxingBackgroundFactory.Build(contentManager.Load("Graphics/bgLayer1"), -1, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height); _background2 = parallaxingBackgroundFactory.Build(contentManager.Load("Graphics/bgLayer2"), -2, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height); _mainBackground = contentManager.Load("Graphics/mainBackground"); _mainBackgroundRect = new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height); }
// Monobehaviour // /// <summary> /// Set up internal data objects. Resolve references to services. /// </summary> void Awake() { // create new list to hold enemy references enemyList = new List<IEnemy>(); // resolve services enemies = IOC.Resolve<IEnemyFactory>(); time = IOC.Resolve<ITimeService>(); registry = IOC.Resolve<IRegistryService>(); shipController = IOC.Resolve<IShipController>(); endGameController = IOC.Resolve<IEndGameController>(); // initialize wave info currentWaveIndex = 0; // get pointer to current wave currentWave = waveData.waves[0]; // set start time on countdown time.SetCountdown(waveData.startTime); }
public Level2(IPlayer player) { backgroundTexture = new Texture(Resources.LevelBG); background = new Sprite(backgroundTexture) { Scale = new Vector2f(WindowProperties.ScaleX, WindowProperties.ScaleY) }; this.player = player; mousePointer = new MousePointer(); enemyFactory = new EnemyFactory(); enemies = new List <IEnemy>(); explosionFactory = new ExplosionFactory(); explosions = new List <Explosion>(); levelClock = new Clock(); backgroundMusic = new Music(Resources.LevelBGMusic) { Loop = true }; backgroundMusic.Play(); }
//SpawnEnemy method will decide what type of enemy will be created //Based on string input public void SpawnEnemy(string enemy) { if (enemy == "Warrior") { factory = new Warrior(); Debug.Log("New Warior equipment:"); Debug.Log(factory.GetWeapon().Item()); Debug.Log(factory.GetArmor().Item()); Debug.Log(""); } else if (enemy == "Mage") { factory = new Mage(); Debug.Log("New Mage equipment:"); Debug.Log(factory.GetWeapon().Item()); Debug.Log(factory.GetArmor().Item()); Debug.Log(""); } else { Debug.Log("Wrong type"); } }
static void Main(string[] args) { IEnemyFactory enemyFactory = LoadFactory(); PrintHeader("LIGHT FIGHTER"); var lightEnemy = enemyFactory.CreateLightEnemy(); lightEnemy.Attack(); lightEnemy.Die(); PrintHeader("Medium FIGHTER"); var mediumEnemy = enemyFactory.CreateMediumEnemy(); mediumEnemy.Attack(); mediumEnemy.Die(); PrintHeader("Heavy FIGHTER"); var heavyEnemy = enemyFactory.CreateHeavyEnemy(); heavyEnemy.Attack(); heavyEnemy.Die(); Console.ReadLine(); }
private void ComposeServices() { this.terrainService = new TerrainService( this); this.headUpDisplayService = new HeadUpDisplayService( this); this.audioService = new AudioService( this); this.enemyFactory = new EnemyFactory( this, terrainService); this.enemyService = new EnemyService( this, enemyFactory); this.playerFactory = new PlayerFactory( this); this.inputService = new InputService( this); this.playerService = new PlayerService( this, inputService, audioService, playerFactory, terrainService); this.collisionDetectionService = new CollisionDetectionService( this, playerService, enemyService, terrainService); this.gameController = new GameController( this, collisionDetectionService, playerService, enemyService, inputService, headUpDisplayService, terrainService, audioService); try { var consoleAssembly = Assembly.Load("SpaceFighter.Console"); var consoleServiceType = consoleAssembly.GetType("SpaceFighter.Console.ConsoleService"); var consoleService = Activator.CreateInstance(consoleServiceType, this); this.Components.Add(consoleService as IGameComponent); } catch(FileNotFoundException) { // No console support available } }
public EnemyService(Game game, IEnemyFactory enemyFactory) : base(game) { this.enemyFactory = enemyFactory; }