void Awake() { gc = GetComponent <gameController>(); if (!GameObject.Find("dataController")) { Instantiate(dataPref); _data = GameObject.Find("dataController(Clone)").GetComponent <dataController>(); } else { _data = GameObject.Find("dataController").GetComponent <dataController>(); } _audio = GameObject.Find("audio").GetComponent <audioController>(); coin = 0; time = 0; timeMinute = 0; distance = 0; gameState = 1; life = 1; tileCount = 0; distance = 0; //StartCoroutine(wait()); sound = GameObject.Find("sound"); checkMuted(); }
public void Awake() { pm = GetComponent <PlayerManager>(); if (!pm) { Debug.LogError("Player Controller: Can't find Player Manager script !"); } animator = GetComponentInChildren <Animator>(); if (!animator) { Debug.LogError("Player Controller: Can't find Animator !"); } audioController = GetComponent <audioController>(); if (!animator) { Debug.LogError("Player Controller: Can't find audioController "); } shield = GetComponentInChildren <Shield>(); if (!shield) { Debug.LogError("Player Controller: Can't find shield "); } /* * quickAttackCommand = "Atk_P" + pm.playerId; * longAttackCommand = "Long_P" + pm.playerId; * shieldCommand = "Shield_P" + pm.playerId; * useCommand = "Use_P" + pm.playerId; * Debug.Log("Player " + pm.playerId + " controls = " + quickAttackCommand + " " + longAttackCommand + " " + shieldCommand + " " + useCommand); */ }
// Use this for initialization void Start() { if (!GameObject.Find("dataController")) { dataObj = Instantiate(dataObj); dataObj.name = "dataController"; } else { dataObj = GameObject.Find("dataController"); } _audio = GameObject.Find("audio").GetComponent <audioController>(); _data = dataObj.GetComponent <dataController>(); createPlayerChar(); highScore.text = _data._data.highestScore.ToString(); coin.text = _data._data.coin.ToString(); startBtn.onClick.AddListener(startGame); customizeBtn.onClick.AddListener(customize); mainBtn.onClick.AddListener(mainMenu); characterBtn.onClick.AddListener(changeCharacter); homeBtn.onClick.AddListener(changeCharacter); nextCharBtn.onClick.AddListener(nextChar); prevCharBtn.onClick.AddListener(prevChar); cameraBtn.onClick.AddListener(openCam); resetBtn.onClick.AddListener(resetFace); audioBtn.onClick.AddListener(muteAudio); checkMuted(); }
// Start is called before the first frame update void Awake() { AC = this; sounds = new Dictionary <string, AudioClip>(); sounds.Add("1", Resources.Load("1", typeof(AudioClip)) as AudioClip); sounds.Add("2", Resources.Load("2", typeof(AudioClip)) as AudioClip); sounds.Add("3", Resources.Load("3", typeof(AudioClip)) as AudioClip); sounds.Add("4", Resources.Load("4", typeof(AudioClip)) as AudioClip); sounds.Add("5", Resources.Load("5", typeof(AudioClip)) as AudioClip); sounds.Add("6", Resources.Load("6", typeof(AudioClip)) as AudioClip); }
private void Start() { gi = GameInfo.autoRef; if (!gi) { Debug.LogError("CarryBattery.cs: Script GameInfo n'a pas d'auto-référence statique !"); } animator = GetComponentInChildren <Animator>(); audioController = GetComponent <audioController>(); movement = GetComponent <PlayerMovement>(); batterySpawner = GameObject.FindGameObjectWithTag("SpawnBattery").GetComponent <BatterySpawner>(); }
// Use this for initialization void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); }
public void Awake() { if(_instance == null) { //If I am the first instance, make me the Singleton _instance = this; DontDestroyOnLoad(this); } else { //If a Singleton already exists and you find //another reference in scene, destroy it! if(this != _instance) Destroy(this.gameObject); } }
public void Awake() { if (_instance == null) { //If I am the first instance, make me the Singleton _instance = this; DontDestroyOnLoad(this); } else { //If a Singleton already exists and you find //another reference in scene, destroy it! if (this != _instance) { Destroy(this.gameObject); } } }
// Start is called before the first frame update void Start() { curFlashCooldown = flashCoolDownTime; curFlashes = maxFlashes; rb2d = GetComponent <Rigidbody2D>(); myAudio = GetComponent <audioController>(); curDoubleJumps = doubleJumps; anim = GetComponent <Animator>(); footsteps = GetComponents <AudioSource>()[1]; GameManager.canFlash = false; GameManager.canFlipGravity = false; GameManager.canMove = false; GameManager.escaped = false; GameManager.hasDied = false; GameManager.reset = false; GameManager.lastCheckpointPosition = transform.position; }
void Awake() { timer = 0F; moves = 0; numpad = FindObjectOfType <numpadController>(); checkButton = FindObjectOfType <checkButtonController>(); arena = FindObjectOfType <arenaManager>(); endGamePanel = FindObjectOfType <EndGameController>(); audio = FindObjectOfType <audioController>(); timerTxt = GameObject.FindGameObjectWithTag("Timer display").gameObject.GetComponent <Text>(); movesTxt = GameObject.FindGameObjectWithTag("Moves display").gameObject.GetComponent <Text>(); numpad.gameObject.SetActive(false); endGamePanel.setActive(false); checkButton.deactivate(); LevelManager.Load(); }
void Awake() { timer = 0F; moves = 0; numpad = FindObjectOfType<numpadController>(); checkButton = FindObjectOfType<checkButtonController>(); arena = FindObjectOfType<arenaManager>(); endGamePanel = FindObjectOfType<EndGameController>(); audio = FindObjectOfType<audioController>(); timerTxt = GameObject.FindGameObjectWithTag("Timer display").gameObject.GetComponent<Text>(); movesTxt = GameObject.FindGameObjectWithTag("Moves display").gameObject.GetComponent<Text>(); numpad.gameObject.SetActive(false); endGamePanel.setActive(false); checkButton.deactivate(); LevelManager.Load(); }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); foreach (soundList s in sounds) { s.source = gameObject.AddComponent <AudioSource>(); s.source.clip = s.clip; s.source.loop = s.Loop; } }