void Start() { if (CanControl) { cam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>(); currentBulletInMagazine = defaultMagezine; foreach (Transform child in transform) { if (child.tag == "firePos") { firepos = child; } if (child.tag == "MuzzleFlash") { MuzzleFlash = child.gameObject; } } lineRenderer = GetComponentsInChildren <LineRenderer>(); currentammo = maxammo; CrossHair = GameObject.FindGameObjectWithTag("CrossHair"); LeftSpreadIndicator = GameObject.FindGameObjectWithTag("LeftCrossHair"); RightSpreadIndicator = GameObject.FindGameObjectWithTag("RightCrossHair"); LeftIndicatorSprite = LeftSpreadIndicator.GetComponentInChildren <SpriteRenderer>(); RightIndicatorSprite = RightSpreadIndicator.GetComponentInChildren <SpriteRenderer>(); audiomanager[] audiomanagers = FindObjectsOfType <audiomanager>(); foreach (var audio in audiomanagers) { if (audio.OnlyOneCanBe == false) { audiomanager = audio; } } } }
// Use this for initialization void Awake() { if (OnlyOneCanBe) { if (Instance == null) { Instance = this; } else { Destroy(this.gameObject); return; } DontDestroyOnLoad(this.gameObject); } foreach (audio s in sounds) { s.AuSource = gameObject.AddComponent <AudioSource>(); s.AuSource.clip = s.amThanh; s.AuSource.outputAudioMixerGroup = s.audioMixerGroup; s.AuSource.volume = s.volume; s.AuSource.pitch = s.pitch; s.AuSource.loop = s.loop; s.AuSource.playOnAwake = s.playOnAwake; if (s.AuSource.playOnAwake) { s.AuSource.Play(); } } }
void Awake() { if (instance == null) { instance = this; } }
private void Awake() { audiomanager[] audiomanagers = FindObjectsOfType <audiomanager>(); foreach (var audio in audiomanagers) { if (audio.OnlyOneCanBe == false) { audiomanager = audio; } } }
// Start is called before the first frame update void Start() { playerHealth = GetComponent <PlayerHealth>(); audioManager = FindObjectOfType <audiomanager>(); extraJumpsLeft = extraJumpsAllowed; rb = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); localScale = transform.localScale; checkPoint = transform.position; canControl = true; }
// Use this for initialization void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
void Awake() { if (instance == null) { instance = this; } else { Destroy(this.gameObject); } DontDestroyOnLoad(this.gameObject); }
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>(); audioManager = GameObject.FindGameObjectWithTag("audioManager").GetComponent <audiomanager>(); colorRandomizer(); }
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>(); }
void Awake() { if (instance == null) { instance = this; } foreach (audiofile s in sounds) { s.source = gameObject.AddComponent <AudioSource>(); s.source.clip = s.clip; s.source.volume = s.volume; s.source.pitch = s.pitch; s.source.loop = s.loop; } }
// Start is called before the first frame update void Start() { rb2D = GetComponent <Rigidbody2D>(); player = GameObject.FindGameObjectWithTag("Player").transform; timeBtwShot = startTimeBtwShot; privateDistanceRaiseMultiplier = 1; audiomanager[] audiomanagers = FindObjectsOfType <audiomanager>(); foreach (var audio in audiomanagers) { if (audio.OnlyOneCanBe == false) { audiomanager = audio; } } }
void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } DontDestroyOnLoad(gameObject); foreach (Sound s in sounds) { s.source = gameObject.AddComponent <AudioSource>(); s.source.clip = s.clip; s.source.volume = s.volume; s.source.pitch = s.pitch; } }
// === 코드 ============================================= void Start() { // 사운드 fm = GameObject.Find("audioManager").GetComponent <audiomanager>(); // 배경음 fm.CreateGroup("BGM"); fm.SoundFolder = "Sounds/"; BGM_STAGE = fm.LoadResourcesSound("BGM", "bg1"); /* BGM_STAGE = fm.LoadResourcesSound("BGM","battle_1"); * BGM_GAMEOVER = fm.LoadResourcesSound("BGM","gameover_1"); */ // 효과음 fm.CreateGroup("SE"); fm.SoundFolder = "Sounds/"; SE_TOUCH_1 = fm.LoadResourcesSound("SE", "UItouch"); SE_COMPLETE = fm.LoadResourcesSound("SE", "chartolocation"); instance = this; }
public virtual void Start() { rb = GetComponent <Rigidbody2D>(); audiomanager = FindObjectOfType <audiomanager>(); }
private void Awake() { audio = audiomanager.GetComponent <audiomanager>(); audio.play("mainmenu"); }
void Awake() { _instance = this; }
// === 코드 ============================================= void Start() { // 사운드 fm = GameObject.Find("audioManager").GetComponent <audiomanager>(); // 배경음 fm.CreateGroup("BGM"); fm.SoundFolder = "Sounds/"; BGM_TITLE = fm.LoadResourcesSound("BGM", "ZT_BGM_Menu"); BGM_STAGE = fm.LoadResourcesSound("BGM", "ZT_BGM_ingame"); /* BGM_STAGE = fm.LoadResourcesSound("BGM","battle_1"); * BGM_GAMEOVER = fm.LoadResourcesSound("BGM","gameover_1"); */ // 효과음 fm.CreateGroup("SE"); fm.SoundFolder = "Sounds/"; SE_bathammer = fm.LoadResourcesSound("SE", "SE_bat,hammer"); SE_button = fm.LoadResourcesSound("SE", "SE_button"); SE_dooropen = fm.LoadResourcesSound("SE", "SE_dooropen"); SE_Explosion01 = fm.LoadResourcesSound("SE", "SE_Explosion01"); SE_fireextinguisher = fm.LoadResourcesSound("SE", "SE_fireextinguisher"); SE_fish = fm.LoadResourcesSound("SE", "SE_fish"); SE_fryingpan = fm.LoadResourcesSound("SE", "SE_fryingpan"); SE_gameover = fm.LoadResourcesSound("SE", "SE_gameover"); SE_get_item = fm.LoadResourcesSound("SE", "SE_get_item"); SE_gun = fm.LoadResourcesSound("SE", "SE_gun"); SE_itembox_open = fm.LoadResourcesSound("SE", "SE_itembox_open"); SE_jump = fm.LoadResourcesSound("SE", "SE_jump"); SE_katana = fm.LoadResourcesSound("SE", "SE_katana"); SE_knife = fm.LoadResourcesSound("SE", "SE_knife"); SE_startlever = fm.LoadResourcesSound("SE", "SE_startlever"); SE_zombie_die = fm.LoadResourcesSound("SE", "SE_zombie_die"); SE_zombie_hit = fm.LoadResourcesSound("SE", "SE_zombie_hit"); SE_zombie_idle = fm.LoadResourcesSound("SE", "SE_zombie_idle"); audiosources.Add("SE_bathammer", SE_bathammer); audiosources.Add("SE_button", SE_button); audiosources.Add("SE_dooropen", SE_dooropen); audiosources.Add("SE_Explosion01", SE_Explosion01); audiosources.Add("SE_fireextinguisher", SE_fireextinguisher); audiosources.Add("SE_fish", SE_fish); audiosources.Add("SE_fryingpan", SE_fryingpan); audiosources.Add("SE_gameover", SE_gameover); audiosources.Add("SE_get_item", SE_get_item); audiosources.Add("SE_gun", SE_gun); audiosources.Add("SE_itembox_open", SE_itembox_open); audiosources.Add("SE_jump", SE_jump); audiosources.Add("SE_katana", SE_katana); audiosources.Add("SE_knife", SE_knife); audiosources.Add("SE_startlever", SE_startlever); audiosources.Add("SE_zombie_die", SE_zombie_die); audiosources.Add("SE_zombie_hit", SE_zombie_hit); audiosources.Add("SE_zombie_idle", SE_zombie_idle); instance = this; }
void Awake() { Instance = this; audiosource = GetComponent<AudioSource> (); }