// Update is called once per frame void Update() { IEnumerable <Vuforia.TrackableBehaviour> tbs = TrackerManager.Instance.GetStateManager().GetActiveTrackableBehaviours(); foreach (TrackableBehaviour tb in tbs) { if (tb.name == "ObjectTarget_car") { Debug.Log(">>>>>> ObjectTarget_car- TrackableName: " + tb.name); Healthbar.DecreaseHealth(.002f); } if (tb.name == "ObjectTarget_tree") { Debug.Log(">>>>>> ObjectTarget_tree- TrackableName: " + tb.name); Healthbar.IncreaseHealth(.002f); } if (tb.name == "ObjectTarget_earth") { Debug.Log(">>>>>> ObjectTarget_tree- TrackableName: " + tb.name); Healthbar.IncreaseHealth(0.1f); } } }
void OnCollisionEnter2D(Collision2D info) { if (info.gameObject.layer == 9 || info.gameObject.layer == 13) { Healthbar PlayerHealth = info.gameObject.GetComponent <Healthbar>(); this.gameObject.SetActive(false); PlayerHealth.IncreaseHealth(amountOfFeed); if (onPlayerEatOrdenaryCrumb != null) { onPlayerEatOrdenaryCrumb(); } //decHealth.GetComponent<Animator>().SetTrigger("RemoveDecreaseHelthPanel"); //incHealth.GetComponent<Animator>().enabled = true; if (hasAbility) { if (onPlayerEatCrumbWithAbility != null) { onPlayerEatCrumbWithAbility(); } GameObject specialAbilityParticals = info.transform.GetChild(1).gameObject; GameObject popupAbilityImage = GameObject.Instantiate(popupAbilityObject); popupAbilityImage.transform.parent = info.transform; popupAbilityImage.transform.position = info.transform.position; specialAbilityParticals.SetActive(false); specialAbilityParticals.SetActive(true); // Debug.Log(specialAbilityParticals.GetComponent<ParticleSystem>().playbackSpeed); //specialAbilityParticals.GetComponent<ParticleSystem>().playbackSpeed = 4; //specialAbilityParticals.GetComponent<ParticleSystem>().Simulate(0); //ParticleSystem.simulate specialAbilities random = (specialAbilities)Random.Range(0, 3); //random = (specialAbilities)3; switch (random) { case specialAbilities.incSpeed: info.gameObject.GetComponent <IntroChicksController>().hasIncSpeedAbility = true; //popupAbilityObject popupAbilityImage.GetComponent <PopUpSpecialAbility>().setup(specialImages[(int)specialAbilities.incSpeed], popupDouration, raiseSpeed); break; case specialAbilities.decSpeed: //ability.decSpeed info.gameObject.GetComponent <IntroChicksController>().hasDecSpeedAbility = true; popupAbilityImage.GetComponent <PopUpSpecialAbility>().setup(specialImages[(int)specialAbilities.decSpeed], popupDouration, raiseSpeed); break; case specialAbilities.reverseControl: //ability.reverseControl info.gameObject.GetComponent <IntroChicksController>().hasReverseControllerAbility = true; popupAbilityImage.GetComponent <PopUpSpecialAbility>().setup(specialImages[(int)specialAbilities.reverseControl], popupDouration, raiseSpeed); break; case specialAbilities.attack: info.gameObject.GetComponent <IntroChicksController>().hasAttackAbility = true; //Debug.Log((int)specialAbilities.attack + "->" + specialImages.Length); popupAbilityImage.GetComponent <PopUpSpecialAbility>().setup(specialImages[(int)specialAbilities.attack], popupDouration, raiseSpeed); break; case specialAbilities.Defened: info.gameObject.GetComponent <IntroChicksController>().hasDefenedAbility = true; //Debug.Log((int)specialAbilities.attack + "->" + specialImages.Length); popupAbilityImage.GetComponent <PopUpSpecialAbility>().setup(specialImages[(int)specialAbilities.Defened], popupDouration, raiseSpeed); break; default: break; } } } else if (info.gameObject.tag == "PlayArea") { this.gameObject.SetActive(false); } else if (info.gameObject.layer == 8) // collide with ground { //ParticleComponent.enableEmission = true; } }