private void LaunchCarrot(float direction) { GameObject obj = GameObject.Instantiate(this.prefabCarrot, transform.position + new Vector3(0, 0.5f, 0), transform.rotation); Carrot carrot = obj.GetComponent <Carrot>(); carrot.Launch(direction); last_carrot = Time.time; }
void launchCarrot(float direction) { GameObject obj = Instantiate(this.prefabCarrot); obj.transform.position = this.transform.position + new Vector3(0, 1, 0); Carrot carrot = obj.GetComponent <Carrot>(); carrot.Launch(direction); }
void LaunchCarrot(float direction) { GameObject obj = GameObject.Instantiate(this.PrefabCarrot); obj.transform.position = new Vector3(this.transform.position.x, this.transform.position.y + 0.7f, .0f); Carrot carrot = obj.GetComponent <Carrot>(); carrot.Launch(direction); }
private void LaunchCarrot(float direction) { // create copy of carrot prefab Carrot carrot = Instantiate(PrefabCarrot).GetComponent <Carrot>(); // set initial position (orc's position) Vector3 carrotPos = transform.position; carrotPos.y += _rabbitWinHeight / 2; carrot.transform.position = carrotPos; // launch carrot.Launch(direction); }
void LaunchCarrot(float direction) { //Створюємо копію Prefab GameObject obj = Instantiate(PrefabCarrot); obj.transform.position = new Vector2(transform.position.x, transform.position.y + transform.localScale.y); obj.GetComponent <SpriteRenderer>().flipX = !GetComponent <SpriteRenderer>().flipX; //Запускаємо в рух Carrot carrot = obj.GetComponent <Carrot> (); carrot.Launch(direction); }
private void LaunchCarrot(float direction) { GameObject carrotObj = Instantiate(carrotPrefab); carrotObj.transform.position = transform.position + new Vector3(0, 0.5f); Carrot carrot = carrotObj.GetComponent <Carrot>(); carrot.Launch(direction); // reset carrot throw cooldown to maximum carrotTime = throwInterval; }
void launchCarrot(float direction) { if (SoundManager.Instance.isSoundOn()) { attackSource.Play(); } GameObject obj = Instantiate(this.prefabCarrot); obj.transform.position = this.transform.position + new Vector3(0, 1, 0); Carrot carrot = obj.GetComponent <Carrot>(); carrot.Launch(direction); }
void launchCarrot(float direction) { //Створюємо копію Prefab GameObject obj = Instantiate(this.prefabCarrot); //Розміщуємо в просторі obj.transform.position = this.transform.position + new Vector3(0, 1, 0); //Запускаємо в рух Carrot carrot = obj.GetComponent <Carrot> (); if (SoundManager.current.isSoundOn()) { attackSource.Play(); } carrot.Launch(direction); }