// ---------------- // void Start() { animator = GetComponent <Animator>(); state = new StandState(animator, this); if (this.gameObject.name == "Enemy") { Level1Script level1 = FindObjectOfType <Level1Script> (); level1.enemyNumber++; } }
private void Update() { if (this.gameObject.name == "Enemy") { if (healthPoints <= 0) { Destroy(this.gameObject); Level1Script level1 = FindObjectOfType <Level1Script> (); level1.enemyNumber--; } Debug.Log(this.state); } }
public void OnResume() { Level1Script level1 = FindObjectOfType <Level1Script> (); if (level1 != null) { level1.paused = false; } else { //Level2Script level2 = FindObjectOfType<Level2Script> (); //level2 = FindObjectOfType<Level2Script> (); } SoundManager.globalMusicVolume = 1F; SceneManager.UnloadSceneAsync("PauseMenu"); }
void Start() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } levelState = "null"; waitTime = 0.0f; stopSpawns = false; pauseWait = false; stopOperationsDone = false; }
private void Start() { player = GameObject.FindGameObjectWithTag("Player"); ratHealthBar = GameObject.FindGameObjectWithTag("RatHealthBar"); animator = gameObject.GetComponent <Animator>(); playerActionScript = player.GetComponent <PlayerController>(); enemyController = GetComponent <EnemyController>(); level = GameObject.FindGameObjectWithTag("Level"); level1Script = level.GetComponent <Level1Script>(); idleCollider = playerActionScript.Idle; dogedCollider = playerActionScript.Doged; ratRB = gameObject.GetComponent <Rigidbody2D>(); maxHealth = enemyController.MaxHealth; startScaleX = ratHealthBar.transform.localScale.x; StartCoroutine(attack()); }
const string password = "******"; // The Password to get right void Start() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(this); } level = 1; MonsterView = new Vector3(0, 14, -150); // Change parent variables to the level settings. WorldView = new Vector3(0, 0, -700); Rotation = new Vector3(0, 0, -10); this.transform.eulerAngles = new Vector3(0, 0, 120); // ---------------- Create the Buttons ---------------- // float angleAdjuster = Random.Range(-0.08f, 0.08f); float worldEdge = this.transform.localScale.x * -12.32f; // fixed amount of where the world edge is buttText = new TextMeshPro[buttons.Length]; buttPressed = new bool[buttons.Length]; for (int i = 0; i < buttons.Length; i++) { buttons[i] = Instantiate(buttonPrefab, transform) as GameObject; // Create and set to the parent level 1 with transform float angle = angleAdjuster * Mathf.PI * 2; Vector3 pos = new Vector3(Mathf.Cos(angle) * worldEdge, Mathf.Sin(angle) * worldEdge, 0); buttons[i].transform.position = pos; buttons[i].transform.eulerAngles = new Vector3(0, 0, Mathf.Atan2(pos.y, pos.x) * 180 / Mathf.PI + 270); #if DEBUG buttText[i] = buttons[i].GetComponentInChildren <TMPro.TextMeshPro>(); #else buttText[i].text = passwordButtLib[Random.Range(0, passwordButtLib.Length)]; #endif buttText[i].text = passwordButtLib[i]; buttPressed[i] = false; angleAdjuster -= 0.015f; } }
// Use this for initialization void Start() { //Private GameObjects player = GameObject.FindWithTag("Player"); //boatAIScriptOne = boatSpawnOne.GetComponent<Boat_AI>(); //boatAIScriptTwo = boatSpawnTwo.GetComponent<Boat_AI>(); level1Script = player.GetComponent <Level1Script>(); level2Script = player.GetComponent <Level2Script>(); level3Script = player.GetComponent <Level3Script>(); level4Script = player.GetComponent <Level4Script>(); level5Script = player.GetComponent <Level5Script>(); level6Script = player.GetComponent <Level6Script>(); level7Script = player.GetComponent <Level7Script>(); level8Script = player.GetComponent <Level8Script>(); level9Script = player.GetComponent <Level9Script>(); level10Script = player.GetComponent <Level10Script>(); Screen.showCursor = false; //Disable Mouse Cursor healthBarLength = Screen.width / 3; //particleFog.enableEmission = false; //deathFog.SetActive (false); //deathFog.enableEmission = false; //Coroutines //StartCoroutine (BuoyLight()); //Functions LighthouseMovement(); LightHouseInput(); HealthandPoints(); StartCoroutine(LevelTitle()); }