// Update is called once per frame void Update() { if (transform.position.y < bottomY) { // Get a reference to the ApplePicker component of Main Camera ApplePicker apScript = Camera.main.GetComponent <ApplePicker>(); rend = GetComponent <Renderer>(); exp = GetComponent <ParticleSystem>(); // Play particle system if (!exp.isPlaying) { // There is no particle system playing if (rend.enabled) { // This is the first frame this apple is at bottomY rend.enabled = false; } else { // Particle system is done playing, destroy apple. Destroy(this); } exp.Play(); // Call the public AppleDestroyed method of apScript apScript.AppleDestroyed(); } } }
public static float bottomY = -20f; //苹果下降底线,越线销毁 private void Update() { /* * 此处可能存在的Bug: * 当第二个苹果还未实例化,第一个实例化的苹果就因下降越线被销毁,则场景内再无Apple预制体, * 则此时 AppleTree脚本 就失去对象applePrefab, * 也就是说后续AppleTree脚本内无法再实例化产生苹果; * 同理后续篮筐也可能带来同样的bug * * 解决方案:保证场景内任意时刻存在一个applePrefab * - 调高树的高度(本例方案) * - 缩短实例化苹果的间隔 * - 先隐藏再延时销毁苹果(理论可行,但感觉大材小用) */ //越线销毁,且判断到篮筐未接住 if (transform.position.y < bottomY) { Destroy(this.gameObject); //当未接住苹果时 //获取主摄像机的ApplePicker组件的引用 ApplePicker apScript = Camera.main.GetComponent <ApplePicker>(); //调用apScript 的 AppleDestroyed 方法 apScript.AppleDestroyed(); } }
void Update() { //*checking speed increase works print(appleSpeed); //* makking apples fall faster this.GetComponent <Rigidbody> ().AddForce(0, -appleSpeed, 0, ForceMode.Impulse); //*rotaing the obj (aesthetics) transform.Rotate(0.5f, Random.Range(5, 10), 2f); // if an apple reaches past -20 units in the Y direction (down) if (transform.position.y < bottomY) { //Only destroy the object that this instance of the script is attached to Destroy(this.gameObject); if (this.tag == "Apple") //*added stuff - bad apple { ////**TUTORIAL CODE //reference ApplePicker script ApplePicker apScript = Camera.main.GetComponent <ApplePicker> (); ////**TUTORIAL CODE //call AppleDestroyed function in ApplePicker script apScript.AppleDestroyed(); } } }
void LoseBasket() { // 获取对主摄像机的ApplePicker组件的引用 ApplePicker apScript = Camera.main.GetComponent <ApplePicker>(); // 调用apScript的BasketDestroyed方法,刚好也是消除最上面的那个篮筐 apScript.BasketDestroyed(); }
private void Start() { GameObject scoreGO = GameObject.Find("Score"); scoreTxt = scoreGO.GetComponent <Text>(); scoreTxt.text = "Spoon: " + score; applePickerScript = Camera.main.GetComponent <ApplePicker>(); }
public void CheckMaxConsecNotPoisonedLinq3() { var applePicker = new ApplePicker(); List <Apple> apples = applePicker.PickApples().Take(10000).ToList(); var maxConsecRedNotPoisoned = new MaxConsecRedNotPoisoned(apples, MaxConsecRedNotPoisoned.Methods.LINQ3); Assert.AreEqual(maxConsecRedNotPoisoned.Result, 10); }
public static float bottomY = -20f; //safe off screen distance for apple void Update() { if (transform.position.y < bottomY) { Destroy(gameObject); //destroys apple ApplePicker apScript = Camera.main.GetComponent <ApplePicker>(); //Notify Apple picker of a missed apple apScript.AppleDestroyed(); } }
void Update() { if (transform.position.y < appleDestroy) { Destroy(this.gameObject); ApplePicker applePicker = new ApplePicker(); applePicker.AppleDestroyed(); } }
// Use this for initialization void Start() { Instance = this; AppleTreeObject.SetActive(false); ResetButton.SetActive(false); GameOver.SetActive(false); AppleObject.SetActive(false); basketList = new List <GameObject>(); }
void Update() // Update is called once per frame { if (transform.position.y < bottomY) { Destroy(this.gameObject); ApplePicker apScript = Camera.main.GetComponent <ApplePicker>(); //Get a reference to the ApplePciker component of Main Camera apScript.AppleDestroyed(); // Call the public AppleDestroyed() method of apScript } }
public void CheckNumberOfTimesGreenSucceedsGreenLinq() { var applePicker = new ApplePicker(); List <Apple> apples = applePicker.PickApples().Take(10000).ToList(); var numberOfTimesGreenSucceedsGreen = new NumberOfTimesGreenSucceedsGreen(apples, NumberOfTimesGreenSucceedsGreen.Methods.ForEach); Assert.AreEqual(numberOfTimesGreenSucceedsGreen.Result, 53); }
// Update is called once per frame void Update() { if (transform.position.y < bottomY) { Destroy(this.gameObject); ApplePicker apScript = Camera.main.GetComponent <ApplePicker>(); //get a reference to the applepicker component of main camera apScript.AppleDestroyed(); } }
void Update() { if (transform.position.y < bottomY) { Destroy(this.gameObject); ApplePicker apScript = Camera.main.GetComponent <ApplePicker>(); apScript.AppleDestroyed(); } }
// Update is called once per frame void Update() { if (transform.position.y < bottomY) { Destroy(this.gameObject); ApplePicker apScript = Camera.main.GetComponent <ApplePicker>(); // b // Call the public AppleDestroyed() method of apScript apScript.AppleDestroyed(); } }
public void CheckRandResultsAreEqual() { var applePicker = new ApplePicker(true); List <Apple> apples = applePicker.PickApples().Take(10000).ToList(); var numberOfTimesGreenSucceedsGreenLinq = new NumberOfTimesGreenSucceedsGreen(apples, NumberOfTimesGreenSucceedsGreen.Methods.LINQ); var numberOfTimesGreenSucceedsGreenForEach = new NumberOfTimesGreenSucceedsGreen(apples, NumberOfTimesGreenSucceedsGreen.Methods.ForEach); Assert.AreEqual(numberOfTimesGreenSucceedsGreenLinq.Result, numberOfTimesGreenSucceedsGreenForEach.Result); }
void Update() { transform.position -= new Vector3(0, fallSpeed * Time.deltaTime, 0); if (transform.position.y < bottomY) { Destroy(this.gameObject); ApplePicker apScript = Camera.main.GetComponent <ApplePicker>(); apScript.AppleDestroyed(); } }
private void DestroyAppleOnFall() { if (this.transform.position.y < MAXFALLPOINT) { Destroy(this.gameObject); ApplePicker applePickerRef = GameObject.FindGameObjectWithTag("GM").GetComponent <ApplePicker>(); applePickerRef.SubtractLife(); } }
void Update() { if (transform.position.y < bottomY) { Destroy(this.gameObject); ApplePicker apScript = Camera.main.GetComponent <ApplePicker>();//here we got the link from the main camera apScript.AppleDesroyed(); } }
void Update() { if (transform.position.y < botomY) { Destroy(this.gameObject); //Call game controller if apple is dropped ApplePicker apScript = Camera.main.GetComponent <ApplePicker> (); apScript.AppleDestroyed(); } }
// Update is called once per frame void Update() { //if we dropped an apple if (transform.position.y < bottomY) { Destroy(this.gameObject); //get a pointer to the ApplePicker script ApplePicker apScript = Camera.main.GetComponent <ApplePicker> (); apScript.AppleDestroyed(); } }
// Update is called once per frame void Update() { if (transform.position.y < bottomY) { Destroy(this.gameObject); // Get a reference to the ApplePicker component of Main Camera ApplePicker apScript = Camera.main.GetComponent <ApplePicker>(); // Call the public AppleDestroyed() method of apScript apScript.AppleDestroyed(); } }
// Update is called once per frame void Update() { if (transform.position.y < bottomY) { Destroy(this.gameObject); // destroy apples if it reaches bottom of the screen ApplePicker apScript = Camera.main.GetComponent <ApplePicker>(); // Call the public AppleDestroyed() method of apScript apScript.AppleDestroyed(); } //end if }
// Update is called once per frame void Update() { //kill off screen apples if (transform.position.y < bottomY) { Destroy(this.gameObject); // Get a reference to the ApplePicker component of Main Camera ApplePicker apScript = Camera.main.GetComponent <ApplePicker>(); // b apScript.AppleDestroyed(); } }
// Update is called once per frame void Update() { if (transform.position.y < bottomY) { Destroy(this.gameObject); // Находим ссылку на ЭплПикер компонент ApplePicker apScript = Camera.main.GetComponent <ApplePicker>(); // Вызываем оттуда функцию apScript.AppleDestroyed(); } }
// Update is called once per frame void Update() { if (transform.position.y < bottomY) { Destroy(this.gameObject); //Получити силку на компонент ApplePicker головної камери Main Camera ApplePicker apScript = Camera.main.GetComponent <ApplePicker>(); //Визов загального методу AppleDestroyed із apScript apScript.AppleDestroyed(); } }
// Update is called once per frame void Update() { if (transform.position.y < bottomY) { Destroy(this.gameObject); // Get a reference to the ApplePicker component of Main Camera ApplePicker appleScript = Camera.main.GetComponent <ApplePicker>(); // Call the public AppleDestroyed() method of appleScript appleScript.AppleDestroyed(); } }
// Update is called once per frame void Update() { transform.Rotate(Vector3.back * Time.deltaTime * rotationSpeed); if (transform.position.y <= bottomY) { Destroy(this.gameObject); ApplePicker apScript = Camera.main.GetComponent <ApplePicker>(); apScript.AppleDestroyed(); } }
void Update() { if (transform.position.y < bottomY) { Destroy(this.gameObject); ApplePicker apScript = Camera.main.GetComponent <ApplePicker>(); apScript.AppleDestroyed(); } transform.Rotate(new Vector3(-100, 0, 0) * Time.deltaTime); }
public static float bottomY = -12f; //where the apple prefab will be destroyed void Update() { if (transform.position.y < bottomY) { Destroy(this.gameObject); } //getting refernce from ApplePicker component of Main Camera ApplePicker apScript = Camera.main.GetComponent <ApplePicker>(); //call public AppleDestroyed() method of apScript apScript.AppleDestroyed(); }
void Start() { controller = GameObject.Find ("Main Camera").GetComponent<ApplePicker>(); }