void Start() { _moveSpeed = Random.Range(4.0f, 6.0f); // _player = FindObjectOfType<Player>(); _thisAudio = GetComponent <AudioSource>(); _errorMessage = FindObjectOfType <ErrorMessagesScript>(); _myRigidBody = GetComponent <Rigidbody2D>(); _audioControllerScript = FindObjectOfType <AudioControllerScript>(); }
void Awake() { if (instance != null) { Debug.LogError("More than one audioController in the scene"); } else { instance = this; } }
// Use this for initialization void Start() { audioManager = AudioControllerScript.instance; if (audioManager == null) { Debug.LogError("someting went horribly wrong (audioController is not found)"); } //find spacer HeroPanelSpacer = GameObject.Find("BattleCanvas").transform.FindChild("HeroPanel").transform.FindChild("HeroPanelSpacer"); //create panel , fill in info CreateHeroPanel(); GameObject performer = GameObject.Find("Enemy"); esm = performer.GetComponent <EnemyStateMachine> (); startPosition = transform.position; cur_cooldown = Random.Range(0, 2.5f); Selector.SetActive(false); BSM = GameObject.Find("BattleManager").GetComponent <BattleStateMachine> (); currentState = TurnState.PROCESSING; Debug.Log("Hero alive"); foreach (GameObject hero in BattleStateMachine.HeroesManaging) { if (hero.name == "Mummy") { _anim = GetComponent <Animator> (); _anim.SetTrigger("Idle"); } else if (hero.name == "Fighter") { _anim = GetComponent <Animator> (); _anim.Play("Idle_Sword_Shield"); } else if (hero.name == "Goblin") { _anim = GetComponent <Animator> (); _anim.Play("idle_battle"); } else if (hero.name == "Skeleton") { _anim = GetComponent <Animator> (); _anim.Play("Idle"); } } SetMummyAnimation("Idle"); SetFighterAnimation("Idle_Sword_Shield"); //SetGoblinAnimation ("idle"); //Animator _anim = GetComponent<Animator>(); //StartCoroutine (TimeForAction ()); }
void Start() { UpdateHeroStats(); audioManager = AudioControllerScript.instance; if (audioManager == null) { Debug.LogError("someting went horribly wrong (audioController is not found)"); } audioManager.Ambient(); magicFire = GameObject.Find("Flash"); magicFire.SetActive(false); magicPoison = GameObject.Find("Poison"); magicPoison.SetActive(false); Vector3 enemyPos = new Vector3(-4.5f, 1f, -1.25f); Enemy = Instantiate(GameManager.instance.selectedEnemies[0], enemyPos, Quaternion.identity) as GameObject; Enemy.transform.name = "Enemy"; Vector3 hero1Pos = new Vector3(3, 1, -3); Hero1 = Instantiate(GameManager.instance.selectedHeroes[0], hero1Pos, Quaternion.identity) as GameObject; string name = GameManager.instance.selectedHeroes [0].GetComponent <HeroStateMachine> ().playerStats.theName; Hero1.transform.name = name; Vector3 hero2Pos = new Vector3(3, 1, 0); Hero2 = Instantiate(GameManager.instance.selectedHeroes[1], hero2Pos, Quaternion.identity) as GameObject; Hero1.transform.Rotate(0, -90, 0); Hero2.transform.Rotate(0, -90, 0); name = GameManager.instance.selectedHeroes [1].GetComponent <HeroStateMachine> ().playerStats.theName; Hero2.transform.name = name; Enemy.transform.Rotate(0, 90, 0); //_anim.Play("Run"); battleStates = PerformAction.WAIT; EnemysInBattle.AddRange(GameObject.FindGameObjectsWithTag("Enemy")); HerosInBattle.AddRange(GameObject.FindGameObjectsWithTag("Hero")); HeroInput = HeroGUI.ACTIVATE; ActionPanel.SetActive(false); EnemySelectPanel.SetActive(false); MagicPanel.SetActive(false); EnemyButtons(); }
void Start() { audioManager = AudioControllerScript.instance; if (audioManager == null) { Debug.LogError("someting went horribly wrong (audioController is not found)"); } currentState = TurnState.PROCESSING; BSM = GameObject.Find("BattleManager").GetComponent <BattleStateMachine>(); BSM.CreateBossPanel(EnemyStats.curHP); if (BSM.Enemy.GetComponent <Animation> () != null) { anim = BSM.Enemy.GetComponent <Animation> (); } else { animator = BSM.Enemy.GetComponent <Animator> (); } startposition = transform.position; currentState = TurnState.WAITING; }
void Awake() { if (activeInstance != null) { Destroy(this.gameObject); return; } else if (activeInstance == null) { activeInstance = this; DontDestroyOnLoad(this); foreach (SoundData sD in soundData) { sD.audioSource = gameObject.AddComponent <AudioSource>(); sD.audioSource.clip = sD.SoundClip; sD.audioSource.volume = sD.volume; sD.audioSource.pitch = sD.pitch; sD.audioSource.loop = sD.loop; } } }
void Awake() { Assert.IsTrue(!instance); instance = this; random = new System.Random((int)System.DateTime.Now.Ticks); }