void Awake() { _sprite = GetComponent <SpriteRenderer>(); gun = GameObject.Find("Gun"); cam = Camera.main; UITextSpawn = GameObject.Find("UITextSpawm").GetComponent <UiTextSpawmControl>(); gunSpot = gun.GetComponent <GunControl>().gunSpot; }
void Start() { //load ve tinh sau power = 3; Instance = this; TextGold.text = "" + PlayerPrefs.GetInt("gold", 0); EXPbar.fillAmount = PlayerPrefs.GetFloat("EXP") / (450 + 500 * PlayerPrefs.GetInt("level", 1)); TextLevel.text = PlayerPrefs.GetInt("level", 1) + ""; }
public void FlockStart() { UiTextSpawmControl = GameObject.Find("UITextSpawm").GetComponent <UiTextSpawmControl>(); _fish = new List <Transform>(); countFish = Random.Range(minCount, maxCount); for (int i = 0; i < countFish; i++) { Transform _tr = Instantiate(_FishPre).transform; _tr.GetComponent <FishFlockControl>().SetLeader(transform); _fish.Add(_tr); _tr.position = new Vector2(transform.position.x, transform.position.y) + Random.insideUnitCircle * 0.8f; // FishManage.Instance._FishMange.Add(_tr); UiTextSpawmControl.fishCount++; Debug.Log("Fish 1 count: " + UiTextSpawmControl.fishCount); } }
public void FollowStart() { UiTextSpawmControl = GameObject.Find("UITextSpawm").GetComponent <UiTextSpawmControl>(); _swim = GetComponent <Swim>(); _fish = new List <Transform>(); countFish = Random.Range(minCount, maxCount); for (int i = 0; i < countFish; i++) { Transform _tr = Instantiate(_FishPre).transform; _tr.position = Vector3.zero; _tr.position = transform.position - transform.right * Distan * i; _tr.right = transform.right; _tr.GetComponent <FishFollowControl>().SetTarget(transform, Vector3.Magnitude(transform.right * Distan * i)); _tr.GetComponent <Swim>().Speed = _swim.Speed; _fish.Add(_tr); UiTextSpawmControl.fishCount++; Debug.Log("Fish 1 count: " + UiTextSpawmControl.fishCount); } }