public override async void _Ready() { _crystal = GetNode <Character>("Crystal"); _waveSpawner = GetNode <WaveSpawner>("WaveSpawner"); _enemyContainer = _waveSpawner.GetEnemyContainer(); _moneyNode = GetNode <MoneyNode>("Hud/Money"); _global = GetTree().Root.GetNode <Global>("Global"); _sceneChanger = GetTree().Root.GetNode <SceneChanger>("SceneChanger"); _jumpScreen = GetNode <JumpScreen>("JumpScreen"); _fireworks = GetNode <Fireworks>("Fireworks"); _deathScreen = GetNode <DeathScreen>("DeathScreen"); _musicPlayer = GetNode <BattleGroundMusicPlayer>("BattleGroundMusicPlayer"); _enemyContainer.Connect(nameof(EnemyContainer.Updated), this, nameof(_OnEnemyContainerUpdated)); _enemyContainer.Connect(nameof(EnemyContainer.EnemyDeath), this, nameof(_OnEnemyDeath)); _stateMachine = new StateMachine(); PauseState = new PauseState(this, _stateMachine); PlayerAttackState = new PlayerAttackState(this, _stateMachine); _stateMachine.Initialize(PlayerAttackState); _jumpScreen.EnterAnimation(); await ToSignal(_jumpScreen, nameof(JumpScreen.AnimationFinished)); foreach (var effect in GetNode <HBoxContainer>("Hud/Effects").GetChildren()) { (effect as Effect).Init(this); } Start(3, _global.Level); }
public override void _Ready() { _enemyContainer = GetNode <EnemyContainer>("EnemyContainer"); _waveSpawnTimer = GetNode <Timer>("WaveSpawnTimer"); _animationPlayer = GetNode <AnimationPlayer>("AnimationPlayer"); _waveLabel = GetNode <Label>("WaveLabel/Value"); }
public Dictionary <int, Enemy> GetDict() { XElement ec = EnemyContainer.Load(path); EnemyInfos = ec.Element("Enemies").Elements("Enemy").Select(c => new Enemy().Set(c)).ToDictionary(info => info.id); return(EnemyInfos); }
public Dictionary <int, Level> GetDict() { XElement lc = EnemyContainer.Load(path); LevelInfos = lc.Element("Levels").Elements("Level").Select(c => new Level().Set(c)).ToDictionary(info => info.id); return(LevelInfos); }
private void SpawnEnemies(int count) { Transform spawn = DifficultyManager.Instance.GetSpawnTransform(); EnemyContainerInstance = Instantiate(EnemyWaveContainerPrefab).GetComponent <EnemyContainer>(); EnemyContainerInstance.Life = enemyLife; EnemyContainerInstance.transform.position = spawn.transform.position; }
public void init(EnemyContainer parent, EnemyType type) { this.parent = parent; this.type = type; this.target = this.parent.getTarget(); agent = GetComponent <UnityEngine.AI.NavMeshAgent>(); player = GameObject.FindWithTag("Player"); lastAttackTime = Time.time; agent.destination = this.target.transform.position; }
public EnemyContainer CreateEnemy(Vector3 at) { EnemyContainer enemy = _assetProvider.Instantiate( AssetPath.EnemyPath, at, Quaternion.identity).GetComponent <EnemyContainer>(); enemy.Init(PlayerContainer.PlayerTransform, PlayerContainer.ShootTarget, EnemyRunAwayWaypoint); Enemies.Add(enemy); return(enemy); }
private void OnStateChanged(GameState state) { Debug.Log(state); switch (state) { case GameState.Lobby: DOVirtual.DelayedCall(0.3f, () => State.Value = GameState.RoundPrepare); // disable physics btw coins, slingshot and stickmen Physics.IgnoreLayerCollision(9, 10); Physics.IgnoreLayerCollision(10, 11); break; case GameState.RoundPrepare: m_level = m_levelContainer.CurrentLevel; m_enemyContainer = m_level.EnemyContainer; // m_player.ToggleInput(false); m_enemyContainer.DeactivateAll(); m_lockerController.IsLockerSafe.Value = true; break; case GameState.Round: GameAnalytics.NewProgressionEvent(GAProgressionStatus.Start, "Game", m_levelContainer.CurrentLevel.name); m_enemyContainer.ActivateAll(); m_player.ToggleInput(true); break; case GameState.Win: GameAnalytics.NewProgressionEvent(GAProgressionStatus.Complete, "Game", m_levelContainer.CurrentLevel.name); m_enemyContainer.DeactivateAll(); m_player.ToggleInput(false); break; case GameState.Fail: GameAnalytics.NewProgressionEvent(GAProgressionStatus.Fail, "Game", m_levelContainer.CurrentLevel.name); m_enemyContainer.DeactivateAll(); break; } }
void Start() { // Path that leads to the asset folder var xmlPath = Application.dataPath + "/enemies.xml"; // Load function from the EnemyContainer class, passing in the path to which xml file to load var xmldat = EnemyContainer.Load(xmlPath); Debug.Log("Name: " + xmldat.Enemies[0].Name); Debug.Log("Health: " + xmldat.Enemies[0].Health); Debug.Log("Level: " + xmldat.Enemies[0].Level); Debug.Log(xmldat.Enemies[1].Nested[0].Boss); Debug.Log(xmldat.Enemies [1].Nested [0].Name); Debug.Log(xmldat.Enemies [0]); //////////////xmldat.Enemies [0].Health = 200; /////////////xmldat.Enemies [0].Name = "Steven"; //Save function - this updates and overwrites the current xml//xmldat.Save(Path.Combine(Application.dataPath, "enemies.xml")); }
void LoadEnemies() { TextAsset textAsset = (TextAsset)Resources.Load(_enemyFile.name); _enemyData = EnemyContainer.LoadFromText(textAsset.text)._data; }
public void Init() { XElement ec = EnemyContainer.Load(path); EnemyInfos = ec.Element("Enemies").Elements("Enemy").Select(c => new Enemy().Set(c)).ToDictionary(info => info.id); }
public void Die(EnemyContainer container) { Destroy(container.gameObject); EnemyContainerInstance = null; }