void Start() { CableTarget = transform; levelStart = FindObjectOfType <LevelStart>(); DayNightCycle = FindObjectOfType <DayNightCycle>(); rb = GetComponent <Rigidbody2D>(); playerSpawnPos = transform.position; deathController = GetComponent <PlayerDeathController>(); spriteRendered = anim.gameObject.GetComponent <SpriteRenderer>(); if (spriteRendered.gameObject.transform.GetChild(0)) { CableTarget = spriteRendered.gameObject.transform.GetChild(0); } CableNextDistance = CableMinDistance; CableLineRendered.SetPosition(0, playerSpawnPos); if (hasCable) { CableLineRendered.SetPosition(1, CableTarget.position); } CanEatLastCablePosition = false; }
public void Awake() { Border = GetComponentInChildren <Border>(); Begin = GetComponentInChildren <LevelStart>(); End = GetComponentInChildren <LevelFinish>(); EnergyPoints = GetComponentsInChildren <EnergyPoint>(); }
void Start() { children = new List <Enemy>(); state = LevelState.Starting; levelStartInstance = Instantiate(levelStartPrefab, transform); levelStartInstance.OnAnimationEnded += OnLevelStartEnd; levelStartInstance.level = this; }
void Start() { spawnManager = new SpawnManager(); state = LevelState.Starting; levelStartInstance = Instantiate(levelStartPrefab, transform); levelStartInstance.OnAnimationEnded += OnLevelStartEnd; levelStartInstance.level = this; }
// Use this for initialization void Start() { levelStart = FindObjectOfType <LevelStart>(); rb = GetComponent <Rigidbody2D>(); //animator.SetFloat(0, Random.Range(0, 1)); float randomIdleStart = Random.Range(0, animator.GetCurrentAnimatorStateInfo(0).length); //Set a random part of the animation to start from animator.Play("EnemyAmination", 0, randomIdleStart); }
public void LevelChoice(string Choice) { GLD.Visible = true; HealthPanel.Visible = true; LevelChooser.Visible = false; mainMenu1.Visible = false; GLD.BringToFront(); HealthPanel.BringToFront(); LevelStart.Invoke(Choice); }
public void Initialize(LevelStart levelStart) { foreach (var tileData in tileDataByPool.Keys) { tileDataByPool[tileData].ReturnToPool(tileData.prefab); } size = MapData.GetMapSize(); Astar.SetGrid(size); CreateBoard(); }
void Start() { i = Random.Range(0, colours.Length); cam = Camera.main; rend = GetComponent <Renderer>(); rb = GetComponent <Rigidbody>(); anim = GetComponent <Animator>(); b_collider = GetComponent <BoxCollider>(); lvl_Man = FindObjectOfType <LevelStart>(); audio_Man = FindObjectOfType <AudioManager>(); mein_Audio = GetComponent <AudioSource>(); // StartCoroutine(ChangeColor()); rend.material.color = colours[i]; }
// Called once per frame void FixedUpdate() { // Initialize the global variables to their most recent state enemies = GameObject.FindGameObjectsWithTag("Enemy"); playerStartPoint = GameObject.FindGameObjectWithTag("PlayerStartPoint"); formationStartPoint = GameObject.FindGameObjectWithTag("FormationStartPoint"); formation = GameObject.FindGameObjectWithTag("EnemyFormation"); ufo = GameObject.FindGameObjectWithTag("UFO"); barriers = GameObject.FindGameObjectsWithTag("BarrierGroup"); levelStart = FindObjectOfType <LevelStart>(); // Check to see if the enemy formation exists if (formation != null) { // If the enemy formation exists, initialize the formation Rigidbody formationRigidBody = formation.gameObject.GetComponent <Rigidbody2D>(); } // Check to see if the UFO exists if (ufo != null) { // If the UFO exists, initialize the UFO Rigidbody ufoRigidbody = ufo.gameObject.GetComponent <Rigidbody2D>(); } // Check to see if the player has been hit if (playerHit) { // If the player has been hit, lose a life and reset the player and enemy formation positions StartCoroutine(LoseLife()); } // Set the player hit flag to false playerHit = false; // Gain an extra life via score interval GainLife(); }
// private Animator topAnim; // private Animator botAnim; void Start () { /* if(topFieldLit && botFieldLit) { botFieldLit = false; }*/ // topAnim = topAnimParent.GetComponent<Animator>(); // botAnim = botAnimParent.GetComponent<Animator>(); levelStart = FindObjectOfType<LevelStart>(); leftSpriteRenderer = leftField.GetComponent<SpriteRenderer>(); rightSpriteRenderer = rightField.GetComponent<SpriteRenderer>(); if (leftFieldDark) { leftSpriteRenderer.color = blackColor; rightSpriteRenderer.color = whiteColor; } else { leftSpriteRenderer.color = whiteColor; rightSpriteRenderer.color = blackColor; } secondsTillSwitch = Random.Range(leastRandomNumber, mostRandomNumber); timeVar = Time.time + secondsTillSwitch; //timeTillSwitchText.text = secondsTillSwitch.ToString(); gameTimerText.text = gameTimer.ToString(); GameManager.instance.FreezeLeftSideEnemies(true); GameManager.instance.FreezeRightSideEnemies(true); }
/// <summary> /// Raise the LevelStart event /// </summary> /// <param name="e"></param> protected virtual void OnLevelStarted(EventArgs e) { LevelStart?.Invoke(this, e); }
public PlayerEnterAction(LevelStart ls) { this.ls = ls; }
public EndLevel(uint code) { ls = Level.GetLevelStarter(code); }
void Awake() { Instance = this; Random.seed = RandomManager.seed; AmmoHealthBug.ClearBugs(); }