// Start is called before the first frame update void Start() { shieldBlocked = GameObject.Find("shieldBlocked"); theEnemy = GameObject.Find("Enemy"); SFXHandler = GameObject.Find("SFXObject"); SFX = SFXHandler.GetComponent <SFXScript>(); }
// Start is called before the first frame update void Start() { player = GameObject.Find("Player"); respawn = player.GetComponent <Respawn>(); logger = GameObject.Find("Telemetry").GetComponent <Logger>(); sfx = GameObject.Find("SFX").GetComponent <SFXScript>(); }
// Start is called before the first frame update void Start() { GameObject.Find("PlayerDeathParticles").GetComponent <ParticleSystem>().Stop(); death = GetComponent <Death>(); logger = GameObject.Find("Telemetry").GetComponent <Logger>(); sfx = GameObject.Find("SFX").GetComponent <SFXScript>(); }
void Awake() { if (instance != null) { print ("more than one instance of SFXScript, or not"); Destroy (this); } else { instance = this; } }
void Start() { Application.targetFrameRate = 60; sfx = GetComponent <SFXScript> (); bugQueueScript = GetComponentInChildren <BugQueueScript> (); bugFarmScript = GetComponentInChildren <BugSpawnerScript> (); healthPool = GetComponent <HealthPoolScript> (); finalBossScript = GetComponentInChildren <FinalBossScript> (); aliceScript = GetComponentInChildren <AliceScript> (); emilyScript = GetComponentInChildren <EmilyScript> (); NextWave(2.0f); }
// Start is called before the first frame update void Start() { player = GameObject.Find("Player"); isGrounded = GetComponent <IsGrounded>(); respawn = player.GetComponent <Respawn>(); progress = player.GetComponent <Progress>(); logger = GameObject.Find("Telemetry").GetComponent <Logger>(); sfx = GameObject.Find("SFX").GetComponent <SFXScript>(); hud = GameObject.Find("HUD"); }
public override void Func(ref line_c line, bool _isInLine) { GameObject loopSFXobj = GameObject.Find(line.m_parameters_txt[0]); if (loopSFXobj == null) { Debug.LogErrorFormat("Failed to stop looping SFX \"{0}\" at line {1}; is not currently playing!", line.m_parameters_txt[0], line.m_origScriptPos); this.scriptMaster.NextLine(); return; } SFXScript stopSFXloop = loopSFXobj.GetComponent <SFXScript>(); stopSFXloop.Stop(line.m_parameters_txt[1]); this.scriptMaster.NextLine(); }
void Awake() { if (!instance) { instance = this; DontDestroyOnLoad(gameObject); audioSource = GetComponent <AudioSource> (); audioSource.loop = true; originalVolume = audioSource.volume; } else { Destroy(gameObject); } }
//private float w_unit = Global.screen_width / 6; //private float h_unit = Global.screen_height / 6; //Scene 실행 전 수행 (초기화) private void Awake() { SFXplayer = GameObject.Find("SoundComponent").GetComponent <SFXScript>(); //Black Screen 방지 Screen.sleepTimeout = SleepTimeout.NeverSleep; //float i_width = (float)(Screen.width)/ (float)(Screen.width); //float i_height = (float)(Screen.height) / (float)(Screen.width); Debug.Log("w : " + Global.screen_width + ", h : " + Global.screen_height); i_width = Global.screen_width / Global.screen_width; i_height = Global.screen_height / Global.screen_width; //fix game resolution 640x640 i_width *= Global.game_res_width; i_height *= Global.game_res_height; Screen.SetResolution((int)i_width, (int)i_height, true); Debug.Log(i_width + "," + i_height); //border Scale edit border_Left.transform.localScale = new Vector3(1, i_height, 10); border_Right.transform.localScale = new Vector3(1, i_height, 10); border_Top.transform.localScale = new Vector3(i_width, 1, 10); border_Bottom.transform.localScale = new Vector3(i_width, 1, 10); //border Position edit border_Left.position = new Vector3(-i_width / 2, 0, 0); border_Right.position = new Vector3(i_width / 2, 0, 0); border_Top.position = new Vector3(0, i_height / 2, 0); border_Bottom.position = new Vector3(0, -i_height / 2, 0); //Tile Map Scale edit Tilemap.transform.localScale = new Vector3(i_width / 5, i_height / 5, 1); //화면 Size 조정. 높이 * pixel per unit /2; camera.orthographicSize = i_height / ppu / 2; //Typing "Spawn();" to test worms in Unity here SFXplayer.PlayWaitBGM(); }
void Start() { age = 0f; AudioSource aSource = GetComponent <AudioSource>(); if (isLoop) { aSource.loop = true; } SFXScript[] sources = FindObjectsOfType <SFXScript>(); List <SFXScript> activeSources = new List <SFXScript>(); for (int i = 0; i < sources.Length; i++) { if (sources[i] != null) { activeSources.Add(sources[i]); } } int n = activeSources.Count - maxSFXPlaying; for (int i = 0; i < n; i++) { float longestTime = -1f; SFXScript oldestSource = null; foreach (SFXScript temp in activeSources) { if (temp.GetAge() > longestTime) { longestTime = temp.GetAge(); oldestSource = temp; } } activeSources.Remove(oldestSource); Destroy(oldestSource.gameObject); } Debug.Log(activeSources.Count); aSource.clip = sfx; aSource.volume = Jukebox.sfxVolume; aSource.Play(); }
private void Start() { SFXplayer = GameObject.Find("SoundComponent").GetComponent <SFXScript>(); rb = gameObject.GetComponent <Rigidbody>(); rb.transform.localScale = headSize; tailPrefab.transform.localScale = tailSize; ate = -100; o = null; thisMesh = gameObject.GetComponent <MeshRenderer>(); WormLight = GameObject.Find("Light[" + Head_index + "]"); ReviveCount = WormLight.GetComponentInChildren <TextMesh>(); jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); jo = jc.GetStatic <AndroidJavaObject>("currentActivity"); }
void Start() { TrmpAnimator = GetComponent <Animator>(); // Кеширование компонентов Manager = GameObject.Find("Manager").GetComponent <TapScript>(); GlobalVelocity = Manager.GetComponent <GlobalTrumpVelocityZeroScript>(); FallScript = GameObject.Find("Manager").GetComponent <FallingScript>(); CandidateCollider = GetComponent <BoxCollider2D>(); TrumpsPool = GameObject.Find("Manager").GetComponent <TrumpOPool>(); SpRend = GetComponent <SpriteRenderer>(); Rb2D = GetComponent <Rigidbody2D>(); MusicScrpt = GameObject.Find("MusicBox").GetComponent <SFXScript>(); Storage = GameObject.Find("Trumps"); currentRotateTimer = RotateTimer; // Установка начальных пременных и границ спауна трампов IceKingHighBoard = IceKingSpawnRate; HolyHighBoard = IceKingHighBoard + HolySpawnRate; TimeHighBoard = HolyHighBoard + TimeSpawnRate; GreenHighBoard = TimeHighBoard + GreenSpawnRate; RedHighBoard = GreenHighBoard + RedSpawnRate; Initialization(); }
void Update() { tempoDeMudarAçã { idleInicial = true; } if (idleInicial) { //se houver algum petisco, o gato vai até ele e come if ((tempoDeMudarAção <= 0 && jarroDePetiscos.petiscoNoChão && !brincando && !comendo && !vagando) || petisco) { petisco = true; if (Vector2.Distance(transform.position, jarroDePetiscos.petiscoInstanciado.position) > tamanhoDoGato) { //muda sprite para animação de andando anim.SetBool("isWalking", true); anim.SetBool("isEating", false); anim.SetBool("isPlaying", false); anim.SetBool("isIdle", false); if (transform.position.x - jarroDePetiscos.petiscoInstanciado.position.x < 0) { rigidbody.velocity = new Vector2(3, 0); rotaçãoAtual.y = 180; transform.eulerAngles = rotaçãoAtual; } else { rigidbody.velocity = new Vector2(-3, 0); rotaçãoAtual.y = 0; transform.eulerAngles = rotaçãoAtual; } if (tempoAnimaçComendoAtual != TempoAnimaçComendoTotal) { tempoAnimaçComendoAtual = TempoAnimaçComendoTotal; } } else if (petiscoTransf != null && tempoAnimaçComendoAtual > 0) { tempoAnimaçComendoAtual -= Time.deltaTime; //muda sprite para animação de comendo anim.SetBool("isWalking", false); anim.SetBool("isEating", true); anim.SetBool("isPlaying", false); anim.SetBool("isIdle", false); } else if (petiscoTransf != null && tempoAnimaçComendoAtual <= 0) { Destroy(petiscoTransf.gameObject); petisco = false; tempoDeMudarAção = 1.5f; jarroDePetiscos.petiscoNoChão = false; //adiciona pontos de saúde ao gato //muda spAtualpara idle anim.SetBool("isWalking", false); anim.SetBool("isEating", false); anim.SetBool("isPlaying", false); anim.SetBool("isIdle", true); SFXScript.PlaySound("romrom"); } } //se a bolinha estiver em movimento, o gato começa a brincar com ela else if ((tempoDeMudarAção <= 0 && brinquedo.emMovimento && !petisco && !comendo /*&& !vagando*/ && gerenteGeral.saciaçãodoDoGato > 25) || brincando) { brincando = true; SFXScript.PlaySound("romrom"); /*tempoAtençãoBrinquedoAtual -= Time.deltaTime; * * if (brinquedo.emMovimento) * { * tempoAtençãoBrinquedoAtual = tempoAtençãoBrinquedoTotal; * }*/ if (Vector2.Distance(transform.position, brinquedoObj.transform.position) > tamanhoDoGato) { //muda sprite para animação de andando anim.SetBool("isWalking", true); anim.SetBool("isEating", false); anim.SetBool("isPlaying", false); anim.SetBool("isIdle", false); if (transform.position.x - brinquedoObj.transform.position.x < 0) { rigidbody.velocity = new Vector2(5, 0); rotaçãoAtual.y = 180; transform.eulerAngles = rotaçãoAtual; } else { rigidbody.velocity = new Vector2(-5, 0); rotaçãoAtual.y = 0; transform.eulerAngles = rotaçãoAtual; } Atual if (tempoAnimaçBrinksAtual != TempoAnimaçBrinksTotal) { tempoAnimaçBrinksAtual = TempoAnimaçBrinksTotal; } } else if (tempoAnimaçBrinksAtual > 0) { tempoAnimaçBrinksAtual -= Time.deltaTime; //muda sprite para animação de brincando anim.SetBool("isWalking", false); anim.SetBool("isEating", false); anim.SetBool("isPlaying", true); anim.SetBool("isIdle", false); } else if (tempoAnimaçBrinksAtual <= 0) { brinquedo.pular(); brincando = false; tempoDeMudarAção = 1.5f; } } else if ((tempoDeMudarAção <= 0 && poteDeRação.temRação && !brinquedo.emMovimento && !petisco && gerenteGeral.saciaçãodoDoGato <= 50) || comendo) { comendo = true; if (Vector2.Distance(transform.position, poteDeRaçãoObj.transform.position) > tamanhoDoGato) { //muda sprite para animação de andando anim.SetBool("isWalking", true); anim.SetBool("isEating", false); anim.SetBool("isPlaying", false); animAtualool("isIdle", false); if (transform.position.x - poteDeRaçãoObj.transform.position.x < 0) { rigidbody.velocity = new Vector2(3, 0); rotaçãoAtual.y = 180; transform.eulerAngles = rotaçãoAtual; } else { rigidbody.velocity = new Vector2(-3, 0); rotaçãoAtual.y = 0; transform.eulerAngles = rotaçãoAtual; } } else if (tempoAnimaçComendoAtual > 0) { tempoAnimaçBrinksAtual -= Time.deltaTime; //muda sprite para animação de comendo anim.SetBool("isWalking", false); anim.SetBool("isEating", true); anim.SetBool("isPlaying", false); anim.SetBool("isIdle", false); } else if (tempoAnimaçComendoAtual <= 0) { poteDeRação.gatoComer(); comendo = false; tempoDeMudarAção = 1.5f; } } //gato fica vagando else if ((tempoDeMudarAção <= 0 && !brinquedo.emMovimento && !petisco && !comendo && gerenteGeral.saciaçãodoDoGato > 25) || vagando) { if (!vagando) { direçAleatVagar = Random.Range(0, 2); tempoDeVagarAtual = tempoDeVagarTotal; } vagando = true; anim.SetBool("isWalking", true); anim.SetBool("isEating", false); anim.SetBool("isPlaying", false); anim.SetBool("isIdle", false); SFXScript.PlaySound("gato1"); switch (direçAleatVagar) { case 0: rigidbody.velocity = new Vector2(5, 0); rotaçãoAtual.y = 180; transform.eulerAngles = rotaçãoAtual; break; case 1: rigidbody.velocity = new Vector2(-5, 0); rotaçãoAtual.y = 0; transform.eulerAngles = rotaçãoAtual; break; } if (tempoDeVagarAtual > 0) { tempoDeVagarAtual -= Time.deltaTime; } if (tempoDeVagarAtual <= 0) { vagando = false; tempoDeMudarAção = 2f; } } else { //gato vai até o pote e fica miando } } }