/// <summary>
    /// Returns the sprite displayed for the passed in ObjectShapes.
    /// </summary>
    /// <param name="objectShape">The ObjectShapes representing the shape of the bouncing object.</param>
    /// <returns>A sprite loaded from resources.</returns>
    public static Sprite GetObjectSprite(ObjectShapes objectShape)
    {
        Sprite retSprite = null;

        switch (objectShape)
        {
        case ObjectShapes.LShape:
            retSprite = Resources.Load <Sprite> (IMAGE_LOCATION + LSHAPE);
            break;

        case ObjectShapes.TShape:
            retSprite = Resources.Load <Sprite> (IMAGE_LOCATION + TSHAPE);
            break;

        case ObjectShapes.XShape:
            retSprite = Resources.Load <Sprite> (IMAGE_LOCATION + XSHAPE);
            break;

        case ObjectShapes.OShape:
            retSprite = Resources.Load <Sprite> (IMAGE_LOCATION + OSHAPE);
            break;

        case ObjectShapes.Spider:
            retSprite = Resources.Load <Sprite> (IMAGE_LOCATION + SPIDER);
            break;

        case ObjectShapes.Cross:
            retSprite = Resources.Load <Sprite> (IMAGE_LOCATION + CROSS);
            break;

        case ObjectShapes.Basketball:
            retSprite = Resources.Load <Sprite> (IMAGE_LOCATION + BASKETBALL);
            break;

        case ObjectShapes.Ladybug:
            retSprite = Resources.Load <Sprite> (IMAGE_LOCATION + LADYBUG);
            break;

        case ObjectShapes.SpiderTwo:
            retSprite = Resources.Load <Sprite> (IMAGE_LOCATION + SPIDERTWO);
            break;

        case ObjectShapes.Gorilla:
            retSprite = Resources.Load <Sprite> (IMAGE_LOCATION + GORILLA);
            break;
        }

        return(retSprite);
    }
Beispiel #2
0
    private void CleanObjects()
    {
        foreach (var i in Objects)
        {
            Destroy(i);
        }

        foreach (var i in ObjectShapes)
        {
            MapCreatorLoader.Instance.ParkingZone.RemoveShape(i);
        }

        foreach (var i in Places)
        {
            i.GetComponent <ParkingPlace>().RemoveShapeNow();
            Destroy(i);
        }

        Objects.Clear();
        ObjectShapes.Clear();
        Places.Clear();
    }
Beispiel #3
0
    private void ReDraw()
    {
        CleanObjects();

        foreach (var i in OutNodes)
        {
            Vector2 p1 = XZ;
            Vector2 p2 = i.XZ;

            GeometryUtil.LineOptions lineOpt = new GeometryUtil.LineOptions(p1, p2);

            lineOpt.CalcNormScale(NormScale);

            Vector2 q1 = lineOpt.MakeNormalOffset(p1, -1);
            Vector2 q2 = lineOpt.MakeNormalOffset(p1, +1);
            Vector2 q4 = lineOpt.MakeNormalOffset(p2, -1);
            Vector2 q3 = lineOpt.MakeNormalOffset(p2, +1);

            CorrectWithMagnetPoints(ref q1, ref q2);
            i.CorrectWithMagnetPoints(ref q3, ref q4);

            var quad = Instantiate(quadZonePrefab);
            MapCreatorLoader.Instance.Attach(quad.gameObject);
            quad.Color = Colors.RoadColor;
            quad.Init(q1, q2, q4, q3);
            var quadRender = quad.gameObject.GetComponent <MeshRenderer>();
            quadRender.sortingOrder = SortingOrder.Is(Layer.Road);
            Objects.Add(quad.gameObject);
            List <Vector2> quadV = new List <Vector2>();
            quadV.Add(q1);
            quadV.Add(q2);
            quadV.Add(q3);
            quadV.Add(q4);
            ObjectShapes.Add(MapCreatorLoader.Instance.ParkingZone.AddShape(quadV, false));

            MakeLine(p1, p2, Colors.NodeLineColor);
        }
    }