예제 #1
0
    void OnTriggerEnterCombinaleObject(Collider other)
    {
        //static object cannot collect or collide with other
        if (thisItemData == null || thisItemData.Stackable == -1)
        {
            return;
        }
        ObjectInGame obj = other.GetComponent <ObjectInGame>();

        if (obj && obj.isCombinableObject() && !other.gameObject.GetPhotonView())
        {
            if (this.isBusy || obj.isBusy)
            {
                return;
            }
            Item           thisData  = this.gameObject.GetComponent <Item>();
            Item           otherData = other.gameObject.GetComponent <Item>();
            CombinationMap map       = GroupGameDatabase.instance.getCombinationMapById(thisData.Id);
            if (map != null && this.photonView.viewID == 0)
            {
                if (map.ItemId01 == thisData.Id && map.ItemId02 == otherData.Id)
                {
                    OnCombineObject(map, this.gameObject, other.gameObject, obj);
                }
                else if (map.ItemId01 == otherData.Id && map.ItemId02 == thisData.Id)
                {
                    OnCombineObject(map, other.gameObject, this.gameObject, this);
                }
                else
                {
                    PopupManager.ShowWrongSignal(this.gameObject.transform.position);
                }
            }
        }
    }
예제 #2
0
    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);
        }
    }