void Start() { for (int i = 0; i < (int)GameData.ColorNames.NumColors; i++) { GameData.SetColorData( (GameData.ColorNames)i, m_pColors[i]); } EndGameLabel.gameObject.SetActiveRecursively(false); ScaleToWin *= GameData.WinSize; m_nCurrentGameMode = GameData.nextGameMode; m_pEnemyManager = GetComponentInChildren<EnemyManager>(); m_pEnemyManager.Initialize(this); m_pPlayer = GetComponentInChildren<Player>(); m_pPlayer.Initialize(this); switch (m_nCurrentGameMode) { case GameData.GameMode.Normal: break; case GameData.GameMode.Endless: ScaleToWin = 100; ScaleToLose = -100; break; case GameData.GameMode.Progression: break; case GameData.GameMode.Reverse: break; default: break; } }
public GameController() { wordManager = new WordManager (); player = new Player (); enemyManager = new EnemyManager (); int buttonLenX = 3; int buttonLenY = 5; panels = new Panel[buttonLenX, buttonLenY]; float buttonSize = 50; Rect buttonRect = new Rect (0, 200, buttonSize, buttonSize); for (int x = 0; x < buttonLenX; x++) { for (int y = 0; y < buttonLenY; y++) { buttonRect.x += buttonSize + 1; panels [x, y] = new Panel (); panels [x, y].position = buttonRect; } buttonRect.x = 0; buttonRect.y += buttonSize + 1; } AddWord (wordManager.GetWord (), ColorType.red); AddWord (wordManager.GetWord (), ColorType.blue); AddWord (wordManager.GetWord (), ColorType.green); }
void Start() { this.enemyManager = GameObject.FindObjectOfType<EnemyManager>(); this.gameManager = GameObject.FindObjectOfType<GameManager>(); // (仮)Unityちゃんを走らせる this.GetComponent<Animator>().SetFloat("Speed", 1.0f); }
void Start() { audio_source = GetComponent<AudioSource> (); if (new_level) { SelectMusic (); new_level = false; } levelManager = GameObject.Find ("LevelLogic").GetComponent<LevelManager> (); enemyManager = GameObject.Find ("LevelLogic").GetComponent<EnemyManager> (); playerManager = GameObject.Find ("LevelLogic").GetComponent<PlayerManager> (); //Form level levelManager.InitLevelMap (); //Update Each Tile in map - includeds asigning values through CA levelManager.UpdateGapsAndPlatforms (); levelManager.UpdateLevelMap (); //Draw level levelMap = levelManager.GetLevelMap (); levelManager.DrawLevelMap (); //Get level map tile array //levelMap = levelManager.GetLevelMap (); enemyManager.LoadMap (levelMap); playerManager.LoadMap (levelMap); //Player must be loaded after level for raycasting to work playerManager.LoadPlayerSpawn (); playerManager.LoadEndPoint (); enemyManager.LoadEnemySpawns (); }
// track the game state // track score // track money // track lives // Use this for initialization void Start() { curGameState = GameState.NotInGame; gameMenu = gameObject.GetComponent<GameMenu>(); enemyManager = gameObject.GetComponent < EnemyManager> (); gridManager = gameObject.GetComponent<GridManager> (); }
void Awake() { rg = GetComponent<Rigidbody> (); animator = GetComponent<Animator> (); enemyManager = GameObject.FindObjectOfType<EnemyManager> (); scrollManager = GameObject.FindObjectOfType<ScrollManager> (); audioSource = GetComponent<AudioSource>(); score = 0.0f; healthSlider.value = 1; this.oriYPos = this.transform.position.y; Debug.Log ("isInfoActive "+ isInfoActive); if (isInfoActive) { enemyManager.enabled = false; //scrollManager.enabled = false; LeanTween.scale( tapToContinue.gameObject, new Vector3 (0.98f, 0.98f, 0.98f), 0.3f).setEase(LeanTweenType.easeOutCirc).setLoopPingPong(-1); } else { DestroyInfoPanel(); animator.SetBool("IsWalking", true); } }
void Awake() { pathFinder = GetComponent<NavMeshAgent>(); _enemyManageRef = GameObject.FindGameObjectWithTag("EnemyManager").GetComponent<EnemyManager>(); StartCoroutine(CrawlAround()); }
public void init(bool justDied) { stextures = Resources.LoadAll<Sprite> ("Textures/Ship Sprite Sheet"); snames = new string[stextures.Length]; for(int ii=0; ii< snames.Length; ii++) { snames[ii] = stextures[ii].name; } captain = new GameObject (); captain.AddComponent<CaptainManager> (); captain.transform.parent = transform; captain.name = "Captain"; GameObject shipH = new GameObject (); shipH.transform.parent = transform; shipH.transform.localPosition = new Vector3 (0, 0, 0); shipH.name = "ShipHandler"; ship = new GameObject (); ship.AddComponent<Ship> (); MakeSprite (ship,stextures[11], shipH.transform, 0, 0, 1, 1, 500); ship.AddComponent<Animator> (); Animator animator = ship.GetComponent<Animator> (); animator.runtimeAnimatorController = Resources.Load<RuntimeAnimatorController> ("Animation/Ship_Animation_Controller"); ship.transform.localScale = new Vector3 (2, 2, 0);jets = new GameObject (); stextures = Resources.LoadAll<Sprite> ("Textures/Ship Effects Sheet"); MakeSprite(jets, stextures[14], ship.transform, 0, -.38f, 1, 1, 100); jets.name = "Jets"; jets.AddComponent<Animator> (); animator = jets.GetComponent<Animator> (); animator.runtimeAnimatorController = Resources.Load<RuntimeAnimatorController> ("Animation/Jet_Animation_Controller"); // ship.SetActive(true); // captain.SetActive(true); MakeSprite (ship, "rocket", shipH.transform, 0, 0, 1, 1, 500); eMan = gameObject.AddComponent<EnemyManager>(); eMan.init (this); <<<<<<< Updated upstream level = 1; <<<<<<< HEAD numLevels = 2; this.GetInstructions ("JERF/level" + level.ToString()); //For now let's just worry about loading and executing a single level. Eventually, we will have to be more sophisticated about restarting levels and loading new levels. May not need separate function longterm. ======= this.GetInstructions ("Assets/Resources/JERF/level1.txt"); //For now let's just worry about loading and executing a single level. Eventually, we will have to be more sophisticated about restarting levels and loading new levels. May not need separate function longterm. >>>>>>> Stashed changes ======= numLevels = 5; //For now let's just worry about loading and executing a single level. Eventually, we will have to be more sophisticated about restarting levels and loading new levels. //May not need separate function longterm. this.GetInstructions ("JERF/level" + level.ToString()); captain.GetComponent<CaptainManager> ().init (this); ship.GetComponent<Ship> ().init (this); GameObject ProtoShip = new GameObject(); stextures = Resources.LoadAll<Sprite> ("Textures/Captain_Effects_Sheet_2"); //for(int ii=0; ii< snames.Length; ii++) { // snames[ii] = stextures[ii].name; //} MakeSprite ( ProtoShip, stextures[0], captain.transform, 0, 0, 1, 1, 100); ProtoShip.name = "ProtoShip"; ProtoShip.GetComponent<Renderer> ().sortingLayerName = "Default"; >>>>>>> PrefabsToCode }
void Awake () { if (instance == null) instance = this; else if (instance != this) Destroy (gameObject); //DontDestroyOnLoad (gameObject); }
public static EnemyManager Get() { if (self == null) { GameObject managers = GameObject.FindGameObjectWithTag ("CustomManagers"); self = managers.GetComponentInChildren<EnemyManager> (); } return self; }
void Start() { enemyManager = GetComponent<EnemyManager>(); //If no player has been set, attempt to find one if (!player) player = GameObject.FindWithTag("Player"); }
void Awake() { if (instance) { GameObject.Destroy (this); } else { instance = this; } }
void Start() { mEnemyManager = GameObject.Find("Main Camera").GetComponent<EnemyManager>(); if (range != 1 && range != 3 && range != 5) range = 1; // if invalid range mNumberOfFrames = 0.0f; }
// Use this for initialization public void init(string typeName, int quantity, float xLoc, float frequency, EnemyManager parent) { type = typeName; num = quantity; x = xLoc; elapsed = 0; freq = frequency; eMan = parent; }
void Awake() { anim = GetComponent <Animator> (); enemyAudio = GetComponent <AudioSource> (); hitParticles = GetComponentInChildren <ParticleSystem> (); capsuleCollider = GetComponent <CapsuleCollider> (); enemyCounter = EnemyManager.Get (); currentHealth = startingHealth; }
public static void Initialize() { LevelManager = new LevelManager(); PlayerManager = new PlayerManager(); EnemyManager = new EnemyManager(); ResourceCache = (new GameObject()).AddComponent<ResourceCache>(); EntityTemplateManager = new EntityTemplateManager(); SoundManager = new SoundManager(); StatsManager = new StatsManager(); }
// Use this for initialization void Start() { //set up the references to other objects go = (GameObject)GameObject.FindGameObjectWithTag("ObjectManager"); myEnemyManager = (EnemyManager)go.GetComponent ("EnemyManager"); go = (GameObject)GameObject.FindGameObjectWithTag("WaveGen"); WE = (WaveEmitter)go.GetComponent("WaveEmitter"); colorIndex=0; }
private int waveNumber = 0; // this is the current wave number // contains initialization subroutines for enemy management void Awake() { if (S != null) { // if an enemy manager already exists Destroy(this); return; } S = this; // set the singleton instance // starts wave 1 at start, and starts a new wave at every wave interval InvokeRepeating("NewWave", 0, waveInterval); }
void Start() { _enemyManager = GameObject.FindObjectOfType<EnemyManager>(); if (_particleSystem) { var emission = _particleSystem.emission; emission.enabled = false; } }
void Awake () { manager = this; enemies= new List<Enemy>(); spawnTimer = spawnTime; spawnCount = 0; }
void Awake() { // Ensure only 1 singleton if (null != _Singleton) { ARKLogger.LogMessage(eLogCategory.General, eLogLevel.System, "EnemyManager: Multiple EnemyManager violate Singleton pattern."); } _Singleton = this; }
public void Init(GameObject manager) { dead = false; Transform info = transform.FindChild("EnemyInfo"); healthMeter = info.FindChild("HealthMeter").GetComponent<Image>(); healthText = info.FindChild("HealthText").GetComponent<Text>(); em = manager.GetComponent<EnemyManager>(); am = manager.GetComponent<AnnouncementManager>(); esc = GetComponent<EnemySoundController>(); HealthInit(); UpdateHealthInfo (); }
public EnemySpawner(EnemyPool[] enemyPools) { _manager = GameObject.FindObjectOfType<EnemyManager>(); _enemyPools = enemyPools; _totalEnemies = 0; _spawnCount = 0; foreach (EnemyPool pool in _enemyPools) { _totalEnemies += pool.count; } //DebugPrint(); //~jus fo debug SetSpawnType(SpawnType.LINEAR); }
protected void EnemyType_Awake() { //Debug.Log("enemy type awake"); _transform = transform; _camera = GameObject.Find("Main Camera").GetComponent<Camera>(); enemymanager = _camera.GetComponent<EnemyManager>(); debugmanager = GameObject.Find("DebugManager").GetComponent<DebugManager>(); eventmanager = _camera.GetComponent<EventManager>(); //resourceManager = _camera.GetComponent<ResourceManager>(); navigation = _camera.GetComponent<Navigation>(); //Получаем доступ к классу myLayerMask = enemymanager.myLayerMask; }
protected void Awake () { instance = this; Game_UIControler.onPause += Game_UIControler_onPause; enemyPool = new List<EnemyBase>(); bossActive = false; if (spawnableEnemies == null) { spawnableEnemies = new GameObject[0]; } }
// TODO: consolodate Awake into Start public override void Awake() { // Set up the reference text = GetComponent<Text>(); // Reset the score. _score = 0; // create new timer _timer = gameObject.AddComponent<Timer>(); _timer.SetTimer(_levelLength); _timer._isPaused = false; _enemyManager = GameObject.FindObjectOfType<EnemyManager>(); }
public void init(EnemyManager owner) { hp = 20; fireRate = 0; speed = 3; this.owner = owner; col = gameObject.AddComponent<CircleCollider2D> (); body = gameObject.AddComponent<Rigidbody2D> (); body.isKinematic = true; transform.eulerAngles = new Vector3(0,0,180); var modelObject = GameObject.CreatePrimitive (PrimitiveType.Quad); model = modelObject.AddComponent<AsteroidModel>(); gameObject.name = "Asteroid"; this.tag = "asteroid"; model.init(this); }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag(Tags.player); enemyManager = EnemyManager._instance; playerAutoMove = player.GetComponent<AutoMove>(); if (eventObject1 != null) { tufeiAutoMove = eventObject1.GetComponent<AutoMove>(); } playerState = PlayerState._instance; nextEvent = new EventDelegate(); nextEvent.target = this; thisEventIsOver = false; setGameObjectHide(); }
void Start() { _uiController = FindObjectOfType<UIController>(); m_playerClassNum = GameObject.FindObjectOfType<AncestorSelection>().selectedAncestor; if(m_playerClassNum==0){ m_playerClassNum = 1; } switch(m_playerClassNum){ case 1: { _warrior._isPlayer = true; Instantiate(_warrior); _warrior._isPlayer = false; break; } case 2: { _priest._isPlayer = true; Instantiate(_priest); _priest._isPlayer = false; break; } case 3: { _mage._isPlayer = true; Instantiate(_mage); _mage._isPlayer = false; break; } case 4: { _rogue._isPlayer = true; Instantiate(_rogue); _rogue._isPlayer = false; break; } } AddOtherAncestors(); m_currentEnemyManger = FindObjectOfType<EnemyManager>(); if ( m_currentEnemyManger == null ) Debug.LogWarning("Director couldn't find Enemy Manager"); }
protected virtual void Start() { HP = HPMax; dropInfo = GameController._instance.GetEnemyInfo(this.enemyID); hash = GameObject.FindGameObjectWithTag(Tags.player).GetComponent<HashIDs>(); anim = this.GetComponent<Animator>(); enemyManager = EnemyManager._instance; normalActionList = actionList.GetNormalActionEvents(); attackActionList = actionList.GetAttackActionEvents(); dieActionList = actionList.GetDieActionEvents(); hitActionList = actionList.GetHitActionEvents(); playerPosition = PlayerState._instance.playerTransform.position; Init(); }
// Start is called before the first frame update void Start() { thePlayer = GameObject.Find("Player").GetComponent <PlayerMovement>(); theEnemyManager = GameObject.FindObjectOfType <EnemyManager>(); }
private void Awake() { text = GetComponent <Text>(); manager = FindObjectOfType <EnemyManager>(); }
void Start() { anim = GetComponent <Animation> (); enemyMan = GameObject.Find("Managers").GetComponent <EnemyManager>(); }
// Update is called once per frame void Update() { RoomLevel.text = "Level: " + currentLevel; switch (currentState) { case GameState.Wait: time = 0f; break; case GameState.IntroSequence: //theEnemyManager.currentHealth = 100; //thePlayerManager.currentHealth = 5; thePlayerManager.setCurrentState(PlayerManager.GameState.EnterScene); //figure out whether the player encounters a shopkeeper or an enemy //update the (enemy or shopkeeper) and player variables //have the player move up // have the ennemy or shopkeeper //move on to the pause before start if (shopKeepLevel) { //WE NEED TO DISABLE THIS VALUE AT SOME POINT!!!!! theShopkeeperManager = FindObjectOfType <ShopkeeperManager>(); //set the shopkeeper to wait } else { theEnemyManager = FindObjectOfType <EnemyManager>(); theEnemyManager.setCurrentState(EnemyManager.GameState.wait); } setCurrentState(GameState.Wait); break; case GameState.PauseBeforeStart: time += Time.deltaTime; //Fight.GetComponent<RectTransform>().anchoredPosition = Vector2.Lerp(new Vector2(-377, -4), new Vector2(-15, -4), time); Fight.GetComponent <RectTransform>().anchoredPosition = new Vector2(Mathf.SmoothStep(-900, -15, time), -4); if (getStateElapsed() > 2.0f) { thePlayerManager.setCurrentState(PlayerManager.GameState.Fight); theEnemyManager.setCurrentState(EnemyManager.GameState.attack); setCurrentState(GameState.FightingEnemy); time = 0.0f; } //check whether we are dealing with the shopkeeper or an ennemy //Fight/Barter comes up from the left, stops in the center, and then moves to the right //move on to FightingEnnemy or ShopKeeper phase break; case GameState.FightingEnemy: time += Time.deltaTime; Fight.GetComponent <RectTransform>().anchoredPosition = new Vector2(Mathf.SmoothStep(-15, 900, time * 3), -4); // new Vector2(-15, -4), new Vector2(387, -4), time*3); if (getStateElapsed() > 1.0f) { theButtonManager.SetAllButtons(true); setCurrentState(GameState.Wait); } //this code might be unnecessary, I think i can do these things from the player and ennemy manager. /*if (enemyIsDefeated) * { * setCurrentState(GameState.OutroSequence); * }else if (playerIsDead) * { * setCurrentState(GameState.GameOverSequence); * }*/ //Activate the player fighting phase //check if either the player or the ennemy are dead //move on to the gameOver or Outro Sequence break; case GameState.OutroSequence: theButtonManager.SetAllButtons(false); theEnemyManager.setCurrentState(EnemyManager.GameState.wait); thePlayerManager.setCurrentState(PlayerManager.GameState.LeaveScene); time += Time.deltaTime * 2; Color tmp = fadeToBlack.color; alpha = Mathf.Lerp(0.0f, 1.0f, time / 2); tmp.a = alpha; fadeToBlack.color = tmp; if (getStateElapsed() > 2.0f) { thePlayerManager.setCurrentState(PlayerManager.GameState.Wait); theEnemyManager.setCurrentState(EnemyManager.GameState.wait); setCurrentState(GameState.ItemCollection); time = 0.0f; } //Have the enemie perform death animation and then fade out. //Then have the player move upwards out of the canvas //Then fade to black //Move on to Item Collection Phase break; case GameState.ItemCollection: //Debug.Log("You have collected this: insert name here"); int fire = 0, water = 0, earth = 0, air = 0; if (!shopKeepLevel) { Collection.text = "You picked up: "; for (int i = 0; i < totalDrop; i++) { if (theEnemyManager.GetComponent <EnemyType>().drop[i] == Item.EmberPebble) { fire += 1; //theInventoryScript.ChangeItemValue(Item.EmberPebble, 1); } else if (theEnemyManager.GetComponent <EnemyType>().drop[i] == Item.GaiaSeed) { earth += 1; //theInventoryScript.ChangeItemValue(Item.GaiaSeed, 1); } else if (theEnemyManager.GetComponent <EnemyType>().drop[i] == Item.NimbusQuill) { air += 1; //theInventoryScript.ChangeItemValue(Item.NimbusQuill, 1); } else if (theEnemyManager.GetComponent <EnemyType>().drop[i] == Item.MermaidScale) { water += 1; //theInventoryScript.ChangeItemValue(Item.MermaidScale, 1); } } if (fire != 0) { Collection.text += "\n Ember Pebble: " + fire; } if (earth != 0) { Collection.text += "\n GaiaSeed: " + earth; } if (air != 0) { Collection.text += "\n NimbusQuill: " + air; } if (water != 0) { Collection.text += "\n MermaidScale: " + water; } Collection.gameObject.SetActive(true); } else { if (thePlayerManager.currentHealth == thePlayerManager.maxHealth && theShopkeeperManager.gameObject.transform.GetChild(0).GetComponent <ShopkeepBucket>().count > 0) { // thePlayerManager.currentHealth -= 25; // thePlayerManager.maxHealth += 50; Collection.text = "Thank you for these resources stranger. \nYou seem in good health, let me enhances your abilities\n\nYour max health pool has increased to: " + (thePlayerManager.maxHealth + 50) + "\nUnfortunately, you had to sustain 25 damage."; } else if (theShopkeeperManager.gameObject.transform.GetChild(0).GetComponent <ShopkeepBucket>().count > 0) { //thePlayerManager.currentHealth += 25; //Mathf.Clamp(thePlayerManager.currentHealth, 0, thePlayerManager.maxHealth); Collection.text = "Thank you for these resources stranger.\nLet me heal your wounds"; } else { Collection.text = "Another time then..."; } Collection.gameObject.SetActive(true); } if (getStateElapsed() > 4.0f) { if (!shopKeepLevel) { if (fire != 0) { theInventoryScript.ChangeItemValue(Item.EmberPebble, fire); } if (earth != 0) { theInventoryScript.ChangeItemValue(Item.GaiaSeed, earth); } if (air != 0) { theInventoryScript.ChangeItemValue(Item.NimbusQuill, air); } if (water != 0) { theInventoryScript.ChangeItemValue(Item.MermaidScale, water); } } else { if (thePlayerManager.currentHealth == thePlayerManager.maxHealth && theShopkeeperManager.gameObject.transform.GetChild(0).GetComponent <ShopkeepBucket>().count > 0) { theShopkeeperManager.gameObject.transform.GetChild(0).GetComponent <ShopkeepBucket>().count = 0; thePlayerManager.currentHealth -= 25; thePlayerManager.maxHealth += 50; //Collection.text = "Thank you for these ressources stranger. \nYou seem in good health, let me enhances your abilities\n\nYour max health pool has increased to: " + thePlayerManager.maxHealth + "\nUnfortunately, you had to sustain 25 damage."; } else if (theShopkeeperManager.gameObject.transform.GetChild(0).GetComponent <ShopkeepBucket>().count > 0) { theShopkeeperManager.gameObject.transform.GetChild(0).GetComponent <ShopkeepBucket>().count = 0; //thePlayerManager.currentHealth += 25; thePlayerManager.currentHealth = Mathf.Clamp(thePlayerManager.currentHealth += 25, 0, thePlayerManager.maxHealth); //Collection.text = "Thank you for theses ressources stranger.\nLet me heal your wounds"; } } Collection.gameObject.SetActive(false); setCurrentState(GameState.RestartPhase); } //Display the Items that were collected //Update the inventory of the player //wait until the player presses continue before restarting the phase //updating levels and percentages might happen here break; case GameState.RestartPhase: //Emable a random room rm.EnableClearRoom(); //this is where we change the background, music, ennemies, shopkeep, etc shopKeepLevel = false; time += Time.deltaTime * 2; Color tmp2 = fadeToBlack.color; alpha = Mathf.Lerp(1.0f, 0.0f, time / 2); tmp2.a = alpha; fadeToBlack.color = tmp2; if (getStateElapsed() > 2.0f) { //attempts to spawn a shopkeeper int levelsSinceShop = currentLevel - lastLevelShop; currentLevel += 1; //level that just ended was a shop, automatically spawn a monster for next level if (levelsSinceShop == 0 && currentLevel != 2) { Destroy(theShopkeeperManager.gameObject); Instantiate(enemies[Random.Range(0, 3)]); rm.EnableRandomRoom(); } else if (levelsSinceShop < 4) { Destroy(theEnemyManager.gameObject); int spawnshop = Random.Range(1, 11); if (spawnshop <= 2) { //Instantiate the shopkeeper Instantiate(shopkeeper); shopKeepLevel = true; lastLevelShop = currentLevel; } else { Instantiate(enemies[Random.Range(0, 3)]); rm.EnableRandomRoom(); } } else if (levelsSinceShop < 8) { Destroy(theEnemyManager.gameObject); int spawnshop = Random.Range(1, 11); if (spawnshop <= 4) { //Instantiate the shopkeeper Instantiate(shopkeeper); shopKeepLevel = true; lastLevelShop = currentLevel; } else { Instantiate(enemies[Random.Range(0, 3)]); rm.EnableRandomRoom(); } } else if (levelsSinceShop < 10) { Destroy(theEnemyManager.gameObject); int spawnshop = Random.Range(1, 11); if (spawnshop <= 6) { //Instantiate the shopkeeper Instantiate(shopkeeper); shopKeepLevel = true; lastLevelShop = currentLevel; } else { Instantiate(enemies[Random.Range(0, 3)]); rm.EnableRandomRoom(); } } else if (levelsSinceShop >= 10) { Destroy(theEnemyManager.gameObject); //instantiate the shopkeeper Instantiate(shopkeeper); shopKeepLevel = true; lastLevelShop = currentLevel; } //Destroy(theEnemyManager.gameObject); //Instantiate(enemies[Random.Range(0, 3)]); time = 0; setCurrentState(GameState.IntroSequence); } break; case GameState.ShopkeeperSequence: //enable the phase to barter/fight the shopkeeper //figure out if we need an other outro sequence for the shopkeeper, or if we can skip that //move back to the intro sequence break; case GameState.PauseScreen: //this is for if we have the time; break; case GameState.GameOverSequence: //Debug.Log("The Player Died: " + getStateElapsed()); if (shopKeepLevel) { theShopkeeperManager.setCurrentState(ShopkeeperManager.GameState.wait); } time += Time.deltaTime * 2; Color tmp3 = fadeToBlack.color; alpha = Mathf.Lerp(0.0f, 1.0f, time); tmp3.a = alpha; fadeToBlack.color = tmp3; if (getStateElapsed() >= 2.0f) { SceneManager.LoadScene(0); } //GAME OVER break; } }
private void Awake() { Instance = this; hasGameField = false; }
void Awake() { Singleton = this; }
void Awake() { Instance = this; }
void Awake() { em = GameObject.Find("EnemyManager").GetComponent <EnemyManager>(); gu = GameObject.Find("Canvas").GetComponent <GameUI>(); currentTime = startingTime; }
public void MapClassSetting(int iCurBlock) //현재 맵의 클래스 셋팅(블록) { //현재 블럭에 맞는 클래스들을 각각 설정 GameManager.instance.BlockIndex = iCurBlock; int iMax = m_BlockList[iCurBlock].BlockClass.Length; for (int i = 1; i < 4; i++) { //초기화 부분 m_BlockNode.transform.GetChild(i).transform.GetChild((int)BLOCK_COMPONENT.COMPONENT_AREA).GetComponent <AreaPoint>()?.CoroutineStart(false); //에리어 포인트 스탑 m_BlockNode.transform.GetChild(i).transform.GetChild((int)BLOCK_COMPONENT.COMPONENT_MARK).gameObject.SetActive(false); //마크 삭제 if (i == 1 || i == 2) { //0->에리어 포인트 1->마크(Companion, boss), 2->스포트라이트 3-<히트포인트 4-<에너미매니저 GameObject Node = m_BlockNode.transform.GetChild(i).transform.GetChild((int)BLOCK_COMPONENT.COMPONENT_SPOT_LIGHT).gameObject; if (Node != null) { Node.GetComponent <SpotLight>().CoroutineStart(false); //코루틴 스탑 Node.SetActive(false); } Node = m_BlockNode.transform.GetChild(i).transform.GetChild((int)BLOCK_COMPONENT.COMPONENT_HIT_POINT).gameObject; Node.SetActive(false); //히트 포인트 체크 Node = m_BlockNode.transform.GetChild(i).transform.GetChild((int)BLOCK_COMPONENT.COMPONENT_ENEMY_MANAGER).gameObject; if (Node != null) { Node.GetComponent <EnemyManager>().EnemyListClear(); //코루틴 스탑 Node.SetActive(false); } } } for (int i = 0; i < iMax; i++) { switch (m_BlockList[iCurBlock].BlockClass[i]) { case MAP_BLOCK_CLASS.BLOCK_START: float fX = 0.0f; fX = m_BlockNode.transform.GetChild(i).transform.position.x; //if (GameManager.instance.MissionStatus == MISSION_STATUS.MISSION_START || // GameManager.instance.MissionStatus == MISSION_STATUS.MISSION_BATTLE_LOSE) //{ // //미션 스타트나, 배틀 루즈시 블럭의 처음 위치로 // fX = m_BlockNode.transform.GetChild(i).transform.position.x; //} //else //{ // fX = GameManager.instance.CurXPosition; //} m_PlayerObject.SetActive(false); m_PlayerObject.transform.position = new Vector3(fX, (float)1.6); Camera.main.GetComponent <FollowCharacter>().m_PlayerTR = m_PlayerObject.transform; break; case MAP_BLOCK_CLASS.BLOCK_MONSTER: //해당 몬스터를 잡은 상태라면 //일반 몬스터는 노란색 1,1,0 //0->에리어 포인트 1->마크(Companion, boss), 2->스포트라이트 3-<히트포인트 4-<에너미매니저 if (GameManager.instance.BlockList[iCurBlock].m_bActive) { m_BlockNode.transform.GetChild(i).transform.GetChild((int)BLOCK_COMPONENT.COMPONENT_SPOT_LIGHT)?.gameObject.SetActive(true); m_BlockNode.transform.GetChild(i).transform.GetChild((int)BLOCK_COMPONENT.COMPONENT_HIT_POINT)?.gameObject.SetActive(true); SpotLight Spot = m_BlockNode.transform.GetChild(i).GetComponentInChildren <SpotLight>(); Spot.OnOffSpeed = m_fNormalSpeed; Spot.OnOffTime = m_fNormalDelayTime; Spot.CoroutineStart(true); Spot.BlockIndex = i; //블록 인덱스 Spot.ColorSetting(1.0f, 1.0f, 0.0f); EnemyManager Enemy = m_BlockNode.transform.GetChild(i).transform.GetChild((int)BLOCK_COMPONENT.COMPONENT_ENEMY_MANAGER).GetComponent <EnemyManager>(); Enemy.Init(GameManager.instance.StageIndex, GameManager.instance.BlockIndex, CHARACTER_TYPE.CHAR_ENEMY); //해당 몬스터를 잡으면 더이 상 활성화 X } break; case MAP_BLOCK_CLASS.BLOCK_COMPANION: if (GameManager.instance.BlockList[iCurBlock].m_bActive) { m_BlockNode.transform.GetChild(i).transform.GetChild((int)BLOCK_COMPONENT.COMPONENT_MARK)?.gameObject.SetActive(true); m_BlockNode.transform.GetChild(i).transform.GetChild((int)BLOCK_COMPONENT.COMPONENT_AREA)?.GetComponent <AreaPoint>().CallBackSetting(CompanionBlock); //엔드포인트 셋팅 m_BlockNode.transform.GetChild(i).transform.GetChild((int)BLOCK_COMPONENT.COMPONENT_AREA)?.GetComponent <AreaPoint>().CoroutineStart(true); //코루틴 스탑 } //동료 블럭 break; case MAP_BLOCK_CLASS.BLOCK_BOSS: if (GameManager.instance.BlockList[iCurBlock].m_bActive) { m_BlockNode.transform.GetChild(i).transform.GetChild((int)BLOCK_COMPONENT.COMPONENT_MARK)?.gameObject.SetActive(true); m_BlockNode.transform.GetChild(i).transform.GetChild((int)BLOCK_COMPONENT.COMPONENT_HIT_POINT)?.gameObject.SetActive(true); //히트 체크 계속 켜줌 EnemyManager Enemy = m_BlockNode.transform.GetChild(i).transform.GetChild((int)BLOCK_COMPONENT.COMPONENT_ENEMY_MANAGER).GetComponent <EnemyManager>(); Enemy.Init(GameManager.instance.StageIndex, GameManager.instance.BlockIndex, CHARACTER_TYPE.CHAR_BOSS); //해당 몬스터를 잡으면 더이 상 활성화 X } //보스 블럭 break; case MAP_BLOCK_CLASS.BLOCK_DANGEROUS: //일반 몬스터는 노란색 1,0,0 if (GameManager.instance.BlockList[iCurBlock].m_bActive) { m_BlockNode.transform.GetChild(i).transform.GetChild((int)BLOCK_COMPONENT.COMPONENT_SPOT_LIGHT)?.gameObject.SetActive(true); m_BlockNode.transform.GetChild(i).transform.GetChild((int)BLOCK_COMPONENT.COMPONENT_HIT_POINT)?.gameObject.SetActive(true); SpotLight Spot = m_BlockNode.transform.GetChild(i).GetComponentInChildren <SpotLight>(); Spot.OnOffSpeed = m_fDangerSpeed; Spot.OnOffTime = m_fDangerDelayTime; Spot.CoroutineStart(true); Spot.BlockIndex = i; //블록 인덱스 Spot.ColorSetting(1.0f, 0.0f, 0.0f); EnemyManager Enemy = m_BlockNode.transform.GetChild(i).transform.GetChild((int)BLOCK_COMPONENT.COMPONENT_ENEMY_MANAGER).GetComponent <EnemyManager>(); Enemy.Init(GameManager.instance.StageIndex, GameManager.instance.BlockIndex, CHARACTER_TYPE.CHAR_DANGEROUS); //해당 몬스터를 잡으면 더이 상 활성화 X } break; case MAP_BLOCK_CLASS.BLOCK_END: m_BlockNode.transform.GetChild(i).transform.GetChild((int)BLOCK_COMPONENT.COMPONENT_AREA).GetComponent <AreaPoint>().CallBackSetting(EndPoint); //엔드포인트 셋팅 m_BlockNode.transform.GetChild(i).transform.GetChild((int)BLOCK_COMPONENT.COMPONENT_AREA).GetComponent <AreaPoint>().CoroutineStart(true); //코루틴 스탑 break; } } m_PlayerObject.SetActive(true); for (int i = 0; i < m_BlockList.Count; i++) { if (i == iCurBlock) { m_BlockInputList[i].CurPlayer(true); } else { m_BlockInputList[i].CurPlayer(false); } m_BlockInputList[i].SelectOK(false); } //그리고 미니맵에 현재 위치 표시 }
private void Awake() { instance = this; }
private void Start() { startFrom = GetComponentInParent <Transform>(); enemyMgr = EnemyManager.Get(); }
void Awake() { instance = this; }
void Start() { amp = Random.Range(3, 10); instance = this; objectPool = new ObjectPool <Enemy>(CuntPrefab, 15, transform); }
private void OnDestroy() { instance = null; }
void Start() { currentPatrolPath = 0; currentDelay = Random.Range(patrolChangeMinDelay, patrolChangeMaxDelay); m_EnemyMobile = FindObjectOfType <EnemyMobile>(); DebugUtility.HandleErrorIfNullFindObject <EnemyMobile, EnemyController>(m_EnemyMobile, this); m_EnemyManager = FindObjectOfType <EnemyManager>(); DebugUtility.HandleErrorIfNullFindObject <EnemyManager, EnemyController>(m_EnemyManager, this); m_ActorsManager = FindObjectOfType <ActorsManager>(); DebugUtility.HandleErrorIfNullFindObject <ActorsManager, EnemyController>(m_ActorsManager, this); m_EnemyManager.RegisterEnemy(this); m_Health = GetComponent <Health>(); DebugUtility.HandleErrorIfNullGetComponent <Health, EnemyController>(m_Health, this, gameObject); m_Actor = GetComponent <Actor>(); DebugUtility.HandleErrorIfNullGetComponent <Actor, EnemyController>(m_Actor, this, gameObject); m_NavMeshAgent = GetComponent <NavMeshAgent>(); m_SelfColliders = GetComponentsInChildren <Collider>(); m_GameFlowManager = FindObjectOfType <GameFlowManager>(); DebugUtility.HandleErrorIfNullFindObject <GameFlowManager, EnemyController>(m_GameFlowManager, this); // Subscribe to damage & death actions m_Health.onDie += OnDie; m_Health.onDamaged += OnDamaged; // Find and initialize all weapons FindAndInitializeAllWeapons(); var detectionModules = GetComponentsInChildren <DetectionModule>(); DebugUtility.HandleErrorIfNoComponentFound <DetectionModule, EnemyController>(detectionModules.Length, this, gameObject); DebugUtility.HandleWarningIfDuplicateObjects <DetectionModule, EnemyController>(detectionModules.Length, this, gameObject); // Initialize detection module m_DetectionModule = detectionModules[0]; m_DetectionModule.onDetectedTarget += OnDetectedTarget; m_DetectionModule.onLostTarget += OnLostTarget; var navigationModules = GetComponentsInChildren <NavigationModule>(); DebugUtility.HandleWarningIfDuplicateObjects <DetectionModule, EnemyController>(detectionModules.Length, this, gameObject); // Override navmesh agent data if (navigationModules.Length > 0) { m_NavigationModule = navigationModules[0]; m_NavMeshAgent.speed = m_NavigationModule.moveSpeed; m_NavMeshAgent.angularSpeed = m_NavigationModule.angularSpeed; m_NavMeshAgent.acceleration = m_NavigationModule.acceleration; } initialSpeed = m_NavMeshAgent.speed; foreach (var renderer in GetComponentsInChildren <Renderer>(true)) { for (int i = 0; i < renderer.sharedMaterials.Length; i++) { if (renderer.sharedMaterials[i] == eyeColorMaterial) { m_EyeRendererData = new RendererIndexData(renderer, i); } if (renderer.sharedMaterials[i] == bodyMaterial) { m_BodyRenderers.Add(new RendererIndexData(renderer, i)); } } } m_BodyFlashMaterialPropertyBlock = new MaterialPropertyBlock(); // Check if we have an eye renderer for this enemy if (m_EyeRendererData.renderer != null) { m_EyeColorMaterialPropertyBlock = new MaterialPropertyBlock(); m_EyeColorMaterialPropertyBlock.SetColor("_EmissionColor", defaultEyeColor); m_EyeRendererData.renderer.SetPropertyBlock(m_EyeColorMaterialPropertyBlock, m_EyeRendererData.materialIndex); } }
void Awake() { instance = this; enemies = ObjectPool.instance.CreatePool(enemyType, enemiesAmount); }
private void Start() { Instance = this; StartCoroutine(nameof(LaunchWaves)); enemiesParentObject = transform.Find("/Enemies"); }
void Start() { animator = GetComponent <Animator>(); enemySpawnCountdown = EnemySpawnInterval; enemyManager = GameObject.Find("EnemyManager").GetComponent <EnemyManager>(); }
void Awake() { enemyManager = GameObject.Find("EnemyManager").GetComponent <EnemyManager>(); totalMirrors = transform.childCount; }
void Awake() { enemyManager = GameObject.Find("GameManager").GetComponent <EnemyManager>(); }
private void Start() { EnemyManager = GetComponent <EnemyManager>(); }
private void OnApplicationQuit() { m_Map.SaveMap(); m_Player.SavePlayer(); EnemyManager.SaveEnemies(); }
public void SpawnEnemies() { EnemyManager enemyManager = GameObject.Find("Spawner").GetComponent <EnemyManager>(); enemyManager.CreateEnemies(); }
private void LoadEnemyData() { EnemyManager.LoadEnemies(m_Map, SaveManager.LoadEnemies()); }
// Use this for initialization void Awake() { enemyManager = this; }
private void PlaceEnemiesRandomly(int _Count) { EnemyManager.SpawnEnemyRandomly(m_Map, _Count); }
public void getManagerAndStyrax(Hero styrax, EnemyManager enManager) { this.styrax = styrax; this.enManager = enManager; }
public override void LoadContent() { var playerTexture1 = _content.Load <Texture2D>("Ships/Player_1"); var playerTexture2 = _content.Load <Texture2D>("Ships/Player_2"); var bulletTexture = _content.Load <Texture2D>("Bullet"); _font = _content.Load <SpriteFont>("Font"); _music = _content.Load <SoundEffect>("Sounds/game"); soundEffectInstance = _music.CreateInstance(); soundEffectInstance.IsLooped = true; soundEffectInstance.Play(); _scoreManager = ScoreManager.Load(); _sprites = new List <Sprite>() { new Sprite(_content.Load <Texture2D>("Background/Game")) { Layer = 0.0f, Position = new Vector2(Game1.ScreenWidth / 2, Game1.ScreenHeight / 2), } }; var bulletPrefab = new Bullet(bulletTexture) { Explosion = new Explosion(new Dictionary <string, Models.Animation>() { { "Explode", new Models.Animation(_content.Load <Texture2D>("Explosion"), 3) { FrameSpeed = 0.1f, } } }) { Layer = 0.5f, } }; if (PlayerCount >= 1) { _sprites.Add(new Player(playerTexture1) { Position = new Vector2(100, 50), Layer = 0.3f, Bullet = bulletPrefab, Input = new Models.Input() { Up = Keys.W, Down = Keys.S, Left = Keys.A, Right = Keys.D, Shoot = Keys.Space, }, Health = 10, Score = new Models.Score() { PlayerName = "Qwerty 1", Value = 0, }, }); } if (PlayerCount >= 2) { _sprites.Add(new Player(playerTexture2) { Position = new Vector2(100, 200), Layer = 0.4f, Bullet = bulletPrefab, Input = new Models.Input() { Up = Keys.Up, Down = Keys.Down, Left = Keys.Left, Right = Keys.Right, Shoot = Keys.Enter, }, Health = 10, Score = new Models.Score() { PlayerName = "Qwerty 2", Value = 0, }, }); } _players = _sprites.Where(c => c is Player).Select(c => (Player)c).ToList(); _enemyManager = new EnemyManager(_content) { Bullet = bulletPrefab, }; }
void Awake() { _inst = this; }
void Start() { enemyManager = GameObject.Find("EnemyManager").GetComponent <EnemyManager> (); for (int i = 0; i < blockInfo.Length; i++) { blockInfo[i].block = gameObject.GetComponent <BlockCollection>().blockNum[i]; //해당 블럭 } for (int i = 0; i < blockInfo.Length; i++) { // case 1 if (gameObject.GetComponent <BlockCollection>().blockNum[i].GetComponent <BlockSpin>().randomNum == 0) { //case 1-1 if (gameObject.GetComponent <BlockCollection>().blockNum[i].GetComponent <BlockSpin>().randomNum2 == 0 || gameObject.GetComponent <BlockCollection>().blockNum[i].GetComponent <BlockSpin>().randomNum2 == 2) { blockInfo[i].localMapFrame[0, 0] = 0; blockInfo[i].localMapFrame[0, 1] = 1; blockInfo[i].localMapFrame[0, 2] = 0; blockInfo[i].localMapFrame[1, 0] = 0; blockInfo[i].localMapFrame[1, 1] = 1; blockInfo[i].localMapFrame[1, 2] = 0; blockInfo[i].localMapFrame[2, 0] = 0; blockInfo[i].localMapFrame[2, 1] = 1; blockInfo[i].localMapFrame[2, 2] = 0; } //case 1-2 if (gameObject.GetComponent <BlockCollection>().blockNum[i].GetComponent <BlockSpin>().randomNum2 == 1 || gameObject.GetComponent <BlockCollection>().blockNum[i].GetComponent <BlockSpin>().randomNum2 == 3) { blockInfo[i].localMapFrame[0, 0] = 0; blockInfo[i].localMapFrame[0, 1] = 0; blockInfo[i].localMapFrame[0, 2] = 0; blockInfo[i].localMapFrame[1, 0] = 1; blockInfo[i].localMapFrame[1, 1] = 1; blockInfo[i].localMapFrame[1, 2] = 1; blockInfo[i].localMapFrame[2, 0] = 0; blockInfo[i].localMapFrame[2, 1] = 0; blockInfo[i].localMapFrame[2, 2] = 0; } } // case 2 if (gameObject.GetComponent <BlockCollection>().blockNum[i].GetComponent <BlockSpin>().randomNum == 1) { //case 2-1 blockInfo[i].localMapFrame[0, 0] = 0; blockInfo[i].localMapFrame[0, 1] = 1; blockInfo[i].localMapFrame[0, 2] = 0; blockInfo[i].localMapFrame[1, 0] = 1; blockInfo[i].localMapFrame[1, 1] = 1; blockInfo[i].localMapFrame[1, 2] = 1; blockInfo[i].localMapFrame[2, 0] = 0; blockInfo[i].localMapFrame[2, 1] = 1; blockInfo[i].localMapFrame[2, 2] = 0; } // case 3 if (gameObject.GetComponent <BlockCollection>().blockNum[i].GetComponent <BlockSpin>().randomNum == 2) { //case 3-1 if (gameObject.GetComponent <BlockCollection>().blockNum[i].GetComponent <BlockSpin>().randomNum2 == 0) { blockInfo[i].localMapFrame[0, 0] = 0; blockInfo[i].localMapFrame[0, 1] = 1; blockInfo[i].localMapFrame[0, 2] = 0; blockInfo[i].localMapFrame[1, 0] = 1; blockInfo[i].localMapFrame[1, 1] = 1; blockInfo[i].localMapFrame[1, 2] = 0; blockInfo[i].localMapFrame[2, 0] = 0; blockInfo[i].localMapFrame[2, 1] = 0; blockInfo[i].localMapFrame[2, 2] = 0; } //case 3-2 if (gameObject.GetComponent <BlockCollection>().blockNum[i].GetComponent <BlockSpin>().randomNum2 == 1) { blockInfo[i].localMapFrame[0, 0] = 0; blockInfo[i].localMapFrame[0, 1] = 0; blockInfo[i].localMapFrame[0, 2] = 0; blockInfo[i].localMapFrame[1, 0] = 1; blockInfo[i].localMapFrame[1, 1] = 1; blockInfo[i].localMapFrame[1, 2] = 0; blockInfo[i].localMapFrame[2, 0] = 0; blockInfo[i].localMapFrame[2, 1] = 1; blockInfo[i].localMapFrame[2, 2] = 0; } //case 3-3 if (gameObject.GetComponent <BlockCollection>().blockNum[i].GetComponent <BlockSpin>().randomNum2 == 2) { blockInfo[i].localMapFrame[0, 0] = 0; blockInfo[i].localMapFrame[0, 1] = 0; blockInfo[i].localMapFrame[0, 2] = 0; blockInfo[i].localMapFrame[1, 0] = 0; blockInfo[i].localMapFrame[1, 1] = 1; blockInfo[i].localMapFrame[1, 2] = 1; blockInfo[i].localMapFrame[2, 0] = 0; blockInfo[i].localMapFrame[2, 1] = 1; blockInfo[i].localMapFrame[2, 2] = 0; } //case 3-4 if (gameObject.GetComponent <BlockCollection>().blockNum[i].GetComponent <BlockSpin>().randomNum2 == 3) { blockInfo[i].localMapFrame[0, 0] = 0; blockInfo[i].localMapFrame[0, 1] = 1; blockInfo[i].localMapFrame[0, 2] = 0; blockInfo[i].localMapFrame[1, 0] = 0; blockInfo[i].localMapFrame[1, 1] = 1; blockInfo[i].localMapFrame[1, 2] = 1; blockInfo[i].localMapFrame[2, 0] = 0; blockInfo[i].localMapFrame[2, 1] = 0; blockInfo[i].localMapFrame[2, 2] = 0; } } // case 4 if (gameObject.GetComponent <BlockCollection>().blockNum[i].GetComponent <BlockSpin>().randomNum == 3) { //case 4-1 if (gameObject.GetComponent <BlockCollection>().blockNum[i].GetComponent <BlockSpin>().randomNum2 == 0) { blockInfo[i].localMapFrame[0, 0] = 0; blockInfo[i].localMapFrame[0, 1] = 1; blockInfo[i].localMapFrame[0, 2] = 0; blockInfo[i].localMapFrame[1, 0] = 1; blockInfo[i].localMapFrame[1, 1] = 1; blockInfo[i].localMapFrame[1, 2] = 1; blockInfo[i].localMapFrame[2, 0] = 0; blockInfo[i].localMapFrame[2, 1] = 0; blockInfo[i].localMapFrame[2, 2] = 0; } //case 4-2 if (gameObject.GetComponent <BlockCollection>().blockNum[i].GetComponent <BlockSpin>().randomNum2 == 1) { blockInfo[i].localMapFrame[0, 0] = 0; blockInfo[i].localMapFrame[0, 1] = 1; blockInfo[i].localMapFrame[0, 2] = 0; blockInfo[i].localMapFrame[1, 0] = 1; blockInfo[i].localMapFrame[1, 1] = 1; blockInfo[i].localMapFrame[1, 2] = 0; blockInfo[i].localMapFrame[2, 0] = 0; blockInfo[i].localMapFrame[2, 1] = 1; blockInfo[i].localMapFrame[2, 2] = 0; } //case 4-3 if (gameObject.GetComponent <BlockCollection>().blockNum[i].GetComponent <BlockSpin>().randomNum2 == 2) { blockInfo[i].localMapFrame[0, 0] = 0; blockInfo[i].localMapFrame[0, 1] = 0; blockInfo[i].localMapFrame[0, 2] = 0; blockInfo[i].localMapFrame[1, 0] = 1; blockInfo[i].localMapFrame[1, 1] = 1; blockInfo[i].localMapFrame[1, 2] = 1; blockInfo[i].localMapFrame[2, 0] = 0; blockInfo[i].localMapFrame[2, 1] = 1; blockInfo[i].localMapFrame[2, 2] = 0; } //case 4-4 if (gameObject.GetComponent <BlockCollection>().blockNum[i].GetComponent <BlockSpin>().randomNum2 == 3) { blockInfo[i].localMapFrame[0, 0] = 0; blockInfo[i].localMapFrame[0, 1] = 1; blockInfo[i].localMapFrame[0, 2] = 0; blockInfo[i].localMapFrame[1, 0] = 0; blockInfo[i].localMapFrame[1, 1] = 1; blockInfo[i].localMapFrame[1, 2] = 1; blockInfo[i].localMapFrame[2, 0] = 0; blockInfo[i].localMapFrame[2, 1] = 1; blockInfo[i].localMapFrame[2, 2] = 0; } } UpdateFrameState(i); } }