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 static void RemoveCharacters(bool top)
 {
     if (top)
     {
         allycharacter = null;
     }
     else
     {
         othercharacter = null;
     }
 }
 public static void AddCharacter(o_character cha, bool top)
 {
     if (top)
     {
         allycharacter = cha;
     }
     else
     {
         othercharacter    = new o_character[1];
         othercharacter[0] = cha;
     }
 }
        protected T GetBullet <T>(BoxCollider2D collisn) where T : o_bullet
        {
            if (collisn == null)
            {
                return(null);
            }

            Collider2D[] chara = Physics2D.OverlapBoxAll(transform.position, collisn.size, 0);

            if (chara == null)
            {
                return(null);
            }
            for (int i = 0; i < chara.Length; i++)
            {
                Collider2D co = chara[i];
                if (co.gameObject == gameObject)
                {
                    continue;
                }

                T b = co.gameObject.GetComponent <T>();
                if (b == null)
                {
                    continue;
                }
                if (targets.Find(x => x == b.parent) != null)
                {
                    o_character host = b.parent;
                    if (host != this)
                    {
                        return(b);
                    }
                }
            }
            return(null);
        }
        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;
                }
            }
        }
        public bool CheckTargetDistance(o_character target, float distance)
        {
            float calcdis = Vector2.Distance(target.transform.position, transform.position);

            return(calcdis <= distance);
        }
 public Vector3 LookAtTarget(o_character target)
 {
     return((target.transform.position - transform.position).normalized);
 }
 public static void SetPlayer(o_character cha)
 {
     player = cha;
 }
 public float TargetDistance(o_character targ)
 {
     return(Vector2.Distance(targ.transform.position, transform.position));
 }