private void ResetGame() { level = 1; score = 0; lives = LIVES_MAX_NUM; UpdateLevel(); UpdateScore(); UpdateLives(); if (!PlayerInstance) { PlayerInstance = Instantiate(PlayerPrefab, Model.PLAYERS_START_POS, Quaternion.identity, GameScreen.transform); } else { PlayerInstance.transform.position = Model.PLAYERS_START_POS; } if (!EnemiesControllerInstance) { EnemiesControllerInstance = Instantiate(EnemiesControllerPrefab, Vector2.zero, Quaternion.identity, GameScreen.transform); EnemiesControllerClass = EnemiesControllerInstance.GetComponent <EnemiesController>(); } else { EnemiesControllerClass.Reset(); } SetGameState(GameState.MAIN); }
void Awake() { enemieC = this; Invoke("SummonFlyer", Random.Range(minFlyerTime, maxFlyerTime)); Invoke("SummonCreeping", Random.Range(minCreepingTime, maxCreepingTime)); Invoke("SummonWalker", Random.Range(minWalkerTime, maxWalkerTime)); }
private void Start() { enemyParentComponent = GetComponent <Enemy>(); sprRend = GetComponent <SpriteRenderer>(); enemiesCont = FindObjectOfType <EnemiesController>(); DecideNextAttack(); }
void Start() { // grab components //enemiesController = GameObject.Find("Enemies").GetComponent<EnemiesController>(); enemiesController = transform.parent.GetComponent <EnemiesController>(); waypoints = enemiesController.GetWaypoinmts(); //waypoints = GameObject.Find("Waypoints").GetComponent<Waypoints>(); RB = GetComponent <Rigidbody2D>(); eSpeed = enemiesController.GetEnemySpeed(); headingIndex = 0; waypointThreshold = 5f; flightOrder = enemiesController.FlightOrder(); if (flightOrder) { heading = waypoints.GetWaypoint(headingIndex).transform; } else { heading = waypoints.GetRNGWaypoint().transform; } NewDirection(); //Spawn(); }
static void Main(string[] args) { var thread = new Thread(new ThreadStart(() => { RenderWindow window = new RenderWindow(new VideoMode(WINDOW_WIDTH, WINDOW_HEIGHT), "SFML Space Shooter"); window.Closed += Window_Closed; GameManager manager = new GameManager(window); PlayerController playerController = new PlayerController(); EnemiesController enemiesController = new EnemiesController(); while (window.IsOpen) { window.DispatchEvents(); window.Clear(); playerController.Update(); foreach (var item in GameManager.GameObjects.ToList()) { item.Update(); UpdatePhysics(item); item.Sprite.Position = item.Position; item.Draw(window, RenderStates.Default); } window.Display(); Thread.Sleep(30); } })); thread.Start(); }
// Use this for initialization void Start() { m_player = GetComponentInChildren <RigidbodyFirstPersonController> ( ); GetComponentInChildren <ShootingController> ( ).Init(m_player.GetComponentInChildren <Camera> ( ).transform); m_enemiesController = GetComponentInChildren <EnemiesController> ( ); m_enemiesController.Init(m_player.transform); }
void Awake() { _playerData = GetComponent <PlayerData>(); _transform = transform; _enemiesController = FindObjectOfType <EnemiesController>(); AddWeapons(); SubscribeOnEvents(); }
public void Strike() { Collider2D[] enemies = Physics2D.OverlapCircleAll(_strikePoint.position, _strikeRange, _enemies); for (int i = 0; i < enemies.Length; i++) { EnemiesController enemy = enemies[i].GetComponent <EnemiesController>(); enemy.TakeDamage(_damage); } }
//Start Method private void Start() { bombController = this.GetComponent <BombController>(); enemiesController = this.GetComponent <EnemiesController>(); timeController = this.GetComponent <TimeController>(); scoreController = this.GetComponent <ScoreController>(); sceneController = this.GetComponent <SceneController>(); extraEggsController = this.GetComponent <ExtraEggsController>(); gamePauseController = this.GetComponent <GamePause>(); }
void Start() { enemiesController = EnemiesController.main; NightMulti = PlayerPrefs.GetFloat("LvlCont"); PlayerPrefs.SetFloat("LvlCont", NightMulti + .3f); NightDuration *= NightMulti + .3f; enemiesController.OnWaveBegins += OnWaveBegins; enemiesController.OnWaveCompleted += OnWaveEnd; enemiesController.OnLastWaveCompleted += EndLVL; }
private void Start() { GetNewSpawnTime(); //Get enemies controller reference enemiesController = FindObjectOfType <EnemiesController>(); enemiesController.SuscribeToEnemySpawner(this); //Get reference of all spawn points in the scene spawnPoints = FindObjectsOfType <SpawnPoints>(); }
private void OnTriggerEnter2D(Collider2D info) { EnemiesController enemy = info.GetComponent <EnemiesController>(); if (enemy != null) { enemy.TakeDamage(_damage); } Destroy(gameObject); }
// Start is called before the first frame update void Start() { enemiesCont = FindObjectOfType <EnemiesController>(); fakeEnemyThis = GetComponent <Enemy>(); enemiesCont.OnEnemySpawnHandler(fakeEnemyThis); dTile = GetComponent <destructableTile>(); dTile.OnDestroyTile += () => { enemiesCont.OnEnemyDieHandler(fakeEnemyThis); }; }
void Awake() { Store = GameObject.Find("Shop"); CloseText = GameObject.Find("CloseText"); ItemWindow = GameObject.FindObjectOfType <StoreManager>().ItemWindow; Player = GameObject.FindObjectOfType <PlayerController>(); player = GameObject.FindGameObjectWithTag("Player").transform; CameraController = GameObject.FindObjectOfType <FollowPlayer>(); Store.SetActive(false); controller = EnemiesController.main; }
public void ReturnsEnemiesController() { // Arrange var db = Mock.Of <INecroDancerContext>(); // Act var controller = new EnemiesController(db); // Assert Assert.IsAssignableFrom <EnemiesController>(controller); }
private void OnCollisionEnter2D(Collision2D collision) { EnemiesController enemy = collision.collider.GetComponent <EnemiesController>(); if (enemy == null || _damageEnemies.Contains(enemy)) { return; } enemy.TakeDamage(_powerStrikeDamage); _damageEnemies.Add(enemy); }
private void Awake() { if (Instance != null && Instance != this) { Destroy(this.gameObject); } else { Instance = this; } }
void Awake() { if (ec == null) { DontDestroyOnLoad(gameObject); ec = this; } else if (ec != this) { Destroy(gameObject); } }
public static void RocketAttack(Soldier executor, EnemiesController controller, LivingEntity target) { //ProjectilesController.Instance.InitializeProjectile(new Projectile(dmg, executor.DamageType, executor.Position, executor, target, // () => // { // var collection = // controller.Entities.Where(entity => entity.IsInRange(target.Position, ExplosionRange)).ToArray(); // for (var i = 0; i < collection.Length; i++) // { // collection[i].GetHit(new Projectile(dmg, executor.DamageType)); // } // })); }
private void Start() { sr = gameObject.GetComponent <SpriteRenderer>(); WhiteMat = Resources.Load("Assets/Materials/WhiteFlash", typeof(Material)) as Material; DefaultMat = sr.material; score = GameObject.FindGameObjectWithTag("Score").GetComponent <ScoreController>(); killcount = GameObject.Find("GameManager").GetComponent <GameManager>(); audioManager = GameObject.FindGameObjectWithTag("audioManager").GetComponent <audiomanager>(); blueEnemySpawner = GameObject.FindGameObjectWithTag("enemyspawn").GetComponent <EnemiesController>(); }
public void Play() { if (costs.total > 100) { return; } gameObject.SetActive(false); GameObject player = PlayerController.GetObject(); CharacterState state = player.GetComponent <CharacterState>(); state.character = character; PlayerController.Activate(); InputController.Activate(); EnemiesController.CreateEnemy(); }
// Update is called once per frame void Update() { timer += Time.deltaTime; EnemiesController bullet = FindObjectOfType <EnemiesController>(); //timerSpeeder += 0.1f*Time.deltaTime; speedSpeeder -= 2f * Time.deltaTime; if (timer >= 2f && bullet == null) { timer = 0; Instantiate(bulletPrefab); } }
void Awake() { if (main == null) { main = this; DontDestroyOnLoad(gameObject); } else if (main == this) { return; } else { Destroy(gameObject); } }
void Start() { Vector3 point = new Vector3(0, 50, 0) + transform.position; Vector3 brotherPoint = point + new Vector3(0, 0, -10); RaycastHit hit; if (Physics.Raycast(point, -transform.up, out hit)) { transform.position = hit.point; } if (Physics.Raycast(brotherPoint, -transform.up, out hit)) { brother.transform.position = hit.point; } controller = EnemiesController.main; controller.OnWaveBegins += Leave; controller.OnWaveCompleted += Arrive; controller.OnLastWaveCompleted += Arrive; }
private void InititalizeGameObjects() { map = new Map(this, level); enemies = map.Enemies; gameEnd = false; pacman = map.Pacman; pacManController = new PacmanController(this, pacman); enemiesController = new EnemiesController(this, map); musicController = new MusicController(this); enemiesController.PacmanWanted += musicController.OnPacmanWanted; enemiesController.BonusEated += musicController.OnPacmanPowerUp; enemiesController.GhostEated += musicController.OnGhostEat; enemiesController.EnemyRestored += musicController.OnEnemyRestored; enemiesController.PacmanDie += musicController.OnPacmanDie; pacManController.BallEated += musicController.OnBallEated; pacman.GameEnd += OnGameEnd; }
//private bool _canFire = true; private void Start() { _enemiesController = FindObjectOfType <EnemiesController>(); }
public DisposeMethod() { controller = new EnemiesController(mockDb.Object); }
public EnemiesControllerTests(MockDatabaseFixture fixture) { var db = fixture.CreateNecroDancerContext(); controller = new EnemiesController(db); }
private void Awake() { instance = this; }
public void Spawn(OnAllEnemiesDestroyedDelegate onAllEnemiesDestroyedDelegate) { _enemiesController = SpawnManager.Instance.CreateEnemiesController(); _enemiesController.SetLastEnemyDeathDelegate(onAllEnemiesDestroyedDelegate); _enemiesController.enabled = false; }
public SoldiersController(GameController gc, EnemiesController enemiesController, Sprite[] soldierSprites) : base(gc) { _ecoController = gc.EconomyController; _enemiesController = enemiesController; _soldierSprites = soldierSprites; }