예제 #1
0
    public static Obj Collision(EventEngine eventEngine, PosObj po, Int32 mode, ref Single distance)
    {
        Obj     result = (Obj)null;
        Single  num    = Single.MaxValue;
        Boolean flag   = (mode & 4) > 0;
        Int32   num2   = (Int32)(4 * (Byte)((!flag) ? po.collRad : po.talkRad));
        Vector3 a      = Vector3.zero;

        if (eventEngine.gMode != 1)
        {
            if (eventEngine.gMode == 3)
            {
                WMActor wmActor = ((Actor)po).wmActor;
                a = wmActor.RealPosition;
            }
            for (ObjList objList = eventEngine.GetActiveObjList(); objList != null; objList = objList.next)
            {
                Obj obj = objList.obj;
                if (obj.sid != 5 || eventEngine.gMode == 3)
                {
                }
                Byte    b     = (Byte)((obj.uid != eventEngine.GetControlUID()) ? 4 : 2);
                Boolean flag2 = (po.flags & b) > 0;
                Single  num3  = (Single)((!flag && !flag2) ? 0 : 1);
                Byte    b2    = (Byte)((!flag) ? ((Byte)((po.uid != eventEngine.GetControlUID()) ? 4 : 2)) : 8);
                Single  num4  = (Single)(obj.flags & b2);
                if (obj != po)
                {
                    Boolean flag3 = num3 <= 0f;
                    Boolean flag4 = num4 <= 0f;
                    if (flag3 || flag4)
                    {
                        flag3 = ((mode & 6) <= 0);
                        flag4 = (eventEngine.GetIP((Int32)obj.sid, (Int32)((!flag) ? 2 : 3), obj.ebData) != eventEngine.nil);
                        if ((flag3 || flag4) && obj.cid == 4)
                        {
                            Actor  actor  = (Actor)obj;
                            Single num5   = 0f;
                            Int32  num6   = (Int32)(4 * (Byte)((!flag) ? actor.collRad : actor.talkRad));
                            PosObj posObj = (PosObj)obj;
                            if (posObj.ovalRatio > 0)
                            {
                                num6 = EventCollision.CalculateRadiusFromOvalRatio(po, posObj, num6);
                            }
                            num6 += num2;
                            if ((mode & 6) != 0)
                            {
                                num6 += (Int32)(actor.speed + 60);
                            }
                            if (eventEngine.gMode == 3)
                            {
                                Single num7 = Vector3.Distance(a, actor.wmActor.RealPosition);
                                Single num8 = num7 * 256f;
                                num5 = num8;
                            }
                            if ((Single)num6 > num5 && num > num5)
                            {
                                result = actor;
                                num    = num5;
                            }
                        }
                    }
                }
            }
            if (distance > 0f)
            {
                distance = num;
            }
            return(result);
        }
        FieldMapActorController component = po.go.GetComponent <FieldMapActorController>();

        if (component == (UnityEngine.Object)null)
        {
            return((Obj)null);
        }
        return(component.walkMesh.Collision(component, mode, out distance));
    }