private void Start() { if (GameObject.FindGameObjectWithTag("bmusic") == null) { Instantiate(backgroundMusic); } BGP = GameObject.FindGameObjectWithTag("AIM").GetComponent <BasicGamePlay>(); BGP.PlayerShoted = true; }
private void Awake() { BGP = GameObject.FindGameObjectWithTag("AIM").GetComponent <BasicGamePlay>(); Player = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); transform.Rotate(0, 0, Random.Range(-4, 4)); toScale = transform.localScale; transform.localScale = Vector3.zero; if (Player.localScale.x >= 0) { this.gameObject.GetComponent <Rigidbody2D>().velocity = transform.right * bulletSpeed; } else { this.gameObject.GetComponent <Rigidbody2D>().velocity = -transform.right * bulletSpeed; } }
private void Start() { audio = GetComponent <AudioSource>(); player = GameObject.FindGameObjectWithTag("Player"); BGP = GameObject.FindGameObjectWithTag("AIM").GetComponent <BasicGamePlay>(); EnemyArmature = GetComponent <UnityArmatureComponent>(); enemyRG = GetComponent <Rigidbody2D>(); if (isFlipped) { directionToDie = Vector2.left; transform.Rotate(0, 180, 0); } else { directionToDie = Vector2.right; } }
private void Start() { playerRigidbody = GetComponent <Rigidbody2D>(); BGP = GameObject.FindGameObjectWithTag("AIM").GetComponent <BasicGamePlay>(); Floor = GameObject.FindGameObjectsWithTag("floor"); for (i = 0; i < Floor.Length; i++) { for (int j = i; j < Floor.Length; j++) { GameObject tmp; float floorPos_i = Floor[i].transform.position.y; float floorPos_j = Floor[j].transform.position.y; if (floorPos_i > floorPos_j) { tmp = Floor[i]; Floor[i] = Floor[j]; Floor[j] = tmp; } } } i = 0; }