public void UpdateHP(float atk) { // hp += atk; FBParticleManager.PlayEffect(FBParticleManager.HIT_ANIMAL, 2, transform.position); parent.OnUpdateHp(uID, atk); if (hp <= 0) { SetState(STATE.DEACTIVE); } }
void OnTriggerEnterAXE(Collider other) { GroupObject obj = other.GetComponent <GroupObject>(); if (obj && obj.tag == "tree") { FBParticleManager.PlayEffect(FBParticleManager.HIT_ANIMAL, 2, other.ClosestPoint(this.transform.position)); FBSoundManager.Play(FBSoundManager.HIT_SOFT); obj.UpdateHP(-AXE_DAMAGE); } }
void OnTriggerEnterMathBullet(Collider other) { if (MathGame.instance.isSentMove()) { Debug.Log("SENT MOVE RETURN"); return; } if (other.gameObject.name.Contains("Math_Balloon")) { string answer = other.GetComponentInChildren <TextMesh>().text.Trim(); int number = int.Parse(answer); MathGame.instance.MakeTurn(number); FBParticleManager.PlayEffect("hit_animal", 1f, other.transform.position); FBSoundManager.Play(FBSoundManager.POP); other.gameObject.SetActive(false); } }
void OnCombineObject(CombinationMap map, GameObject item01, GameObject itemDock, ObjectInGame dockManager) { dockManager.isBusy = true; FBPoolManager.instance.returnObjectToPool(item01); int itemFinal = map.ItemIdFinal; Item finalObj = GroupGameDatabase.instance.GetItemByID(itemFinal); this.itemDockPos = itemDock.transform.position; dockManager.finalObjectName = finalObj.prefabName; //display timer FBParticleManager.PlayEffect(FBParticleManager.EFFECT_COMBINE_OBJECT, 2, itemDockPos); FBSoundManager.Play(FBSoundManager.COMBINE_SOUND); GameObject timerDialog = PopupManager.ShowTimer("Group_Timer", map.Duration, itemDock); timerDialog.GetComponent <BasePopup>().eventCompleteTimer += dockManager.ObjectInGame_eventCompleteTimer; //fake collect display for another player PhotonView playerPhotonView = Player.instance.visualPlayer.GetPhotonView(); playerPhotonView.RPC("SendFakeCollectItem", PhotonTargets.AllViaServer, playerPhotonView.viewID, itemFinal, itemDock.gameObject.name); }
void OnTriggerEnterQuestObject(Collider other) { //update quest process data ObjectInGame obj = other.GetComponent <ObjectInGame>(); Transform pos = this.transform.findChildRecursively("wrong_marker"); if (obj && obj.isCombinableObject() && other.gameObject.GetPhotonView().viewID == 0) { SendTriggerQuestItem = true; other.gameObject.SetActive(false); Item otherData = other.gameObject.GetComponent <Item>(); QuestData q = listQuestData.Find(x => x.requireItemId == otherData.Id); if (q != null && !QuestManager.instance.isFinishQuest(q)) { FBPoolManager.instance.returnObjectToPool(other.gameObject); QuestManager.instance.UpdateQuestProcess(q, +1); FBParticleManager.PlayEffect(FBParticleManager.EFFECT_COMBINE_OBJECT, 2, pos ? pos.position : this.transform.position); FBSoundManager.Play(FBSoundManager.COMBINE_SOUND); Invoke("ResetSendTrigger", 2f); } else { if (pos) { PopupManager.ShowWrongSignal(pos.position); } else { PopupManager.ShowWrongSignal(this.transform.position); } } } else { FBPoolManager.instance.returnObjectToPool(other.gameObject); } }