Пример #1
0
        new void Update()
        {
            o_character col = IfTouchingGetCol <o_character>(collision);

            if (col != null)
            {
                o_character p = col.GetComponent <o_character>();

                if (p != null)
                {
                    if (p.GetComponent <o_character>() || !p.AI)
                    {
                        switch (it)
                        {
                        case ITEM_TYPE.MONEY:
                            s_globals.Money += 1;
                            s_map mp = GameObject.Find("General").GetComponent <s_levelloader>().mapDat;
                            mp.gemCount++;
                            s_save_item it = mp.itemdat.Find(x => x.ID == indexID);
                            it.iscollected = true;
                            break;
                        }
                    }
                    DespawnObject();
                }
                //DespawnObject();
            }
        }
        public new void Update()
        {
            base.Update();
            if (!s_triggerhandler.trig.doingEvents)
            {
                switch (TRIGGER_T)
                {
                case TRIGGER_TYPE.CONTACT:

                    o_character c = IfTouchingGetCol <o_character>(collision);
                    if (c != null)
                    {
                        selobj = c.gameObject.GetComponent <s_object>();
                        //print(name + c.name);
                        if (selobj)
                        {
                            o_character posses = selobj.GetComponent <o_character>();
                            //print(name + c.name);
                            o_character ch = c.GetComponent <o_character>();
                            if (ch)
                            {
                                if (!ch.AI)
                                {
                                    //print("Activating trigger");
                                    s_triggerhandler.trig.selobj = selobj;
                                    if (stringLabelToJumpTo != "")
                                    {
                                        s_triggerhandler.trig.JumpToEvent(stringLabelToJumpTo, callstatic);
                                    }
                                    else
                                    {
                                        s_triggerhandler.trig.JumpToEvent(LabelToJumpTo, callstatic);
                                    }
                                    if (destroyOnTouch)
                                    {
                                        Destroy(gameObject);
                                    }
                                }
                            }
                        }
                    }
                    break;

                case TRIGGER_TYPE.CONTACT_INPUT:
                    if (Input.GetKeyDown(s_globals.GetKeyPref("select")))
                    {
                        c = IfTouchingGetCol <o_character>(collision);
                        if (c != null)
                        {
                            selobj = c.gameObject.GetComponent <s_object>();
                            //print(name + c.name);
                            if (selobj)
                            {
                                o_character posses = selobj.GetComponent <o_character>();
                                o_character ch     = posses.GetComponent <o_character>();
                                if (ch)
                                {
                                    if (!ch.AI)
                                    {
                                        //print("Activating trigger");
                                        s_triggerhandler.trig.selobj = selobj;
                                        if (stringLabelToJumpTo != "")
                                        {
                                            s_triggerhandler.trig.JumpToEvent(stringLabelToJumpTo, callstatic);
                                        }
                                        else
                                        {
                                            s_triggerhandler.trig.JumpToEvent(LabelToJumpTo, callstatic);
                                        }
                                        if (destroyOnTouch)
                                        {
                                            Destroy(gameObject);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    break;
                }
            }
        }