예제 #1
0
        public bool CheckCollisions(PhysicsObj obj)
        {
            SpherePath.InsertType = InsertType.Placement;
            SpherePath.SetCheckPos(SpherePath.CurPos, SpherePath.CurCell);

            return(obj.FindObjCollisions(this) != TransitionState.OK);
        }
예제 #2
0
파일: Transition.cs 프로젝트: zarlant/ACE
        public TransitionState CheckOtherCells(ObjCell currCell)
        {
            var result = TransitionState.OK;

            SpherePath.CellArrayValid   = true;
            SpherePath.HitsInteriorCell = false;
            ObjCell newCell = new ObjCell();    // null check?

            ObjCell.find_cell_list(CellArray, ref newCell, SpherePath);

            foreach (var cell in CellArray.Cells.Values)
            {
                if (cell == null || cell.Equals(currCell))
                {
                    continue;
                }
                var collides = cell.FindCollisions(this);
                switch (collides)
                {
                case TransitionState.Slid:
                    CollisionInfo.ContactPlaneValid   = false;
                    CollisionInfo.ContactPlaneIsWater = false;
                    return(collides);

                case TransitionState.Collided:
                case TransitionState.Adjusted:
                    return(collides);
                }
            }

            SpherePath.CheckCell = newCell;

            if (newCell != null)
            {
                SpherePath.AdjustCheckPos(newCell.ID);
                return(result);
            }
            if (SpherePath.StepDown)
            {
                return(TransitionState.Collided);
            }

            var checkPos = SpherePath.CheckPos;

            if ((checkPos.ObjCellID & 0xFFFF) < 0x100)
            {
                LandDefs.AdjustToOutside(checkPos);
            }

            if (checkPos.ObjCellID != 0)
            {
                SpherePath.AdjustCheckPos(checkPos.ObjCellID);
                SpherePath.SetCheckPos(checkPos, null);

                SpherePath.CellArrayValid = true;

                return(result);
            }
            return(TransitionState.Collided);
        }