public MethodInvokeExpressionNode() : base("out", "Out (ref exp)")
 {
     name         = "Method Invoke";
     m_Method     = CreateInputSlot <EmptySlot <CodeMethodReferenceExpression> >("method", "Method (ref exp)");
     m_Parameters = CreateInputSlot <EmptySlot <CodeExpression> >("params", "Params (exp)");
     m_Parameters.allowMultipleConnections = true;
 }
Exemple #2
0
    bool CheckForNoMoreMoves()
    {
        int midSlotIndex = 0, sub = 0;

        for (int index = 0; index < Slots.Length; index++)
        {
            _slotIter = Slots[index];

            //Debug.Log(_slotIter.Index + " " + _slotIter.HasPeg);
            if (_slotIter.HasPeg)
            {
                for (sub = 0; sub < Slots.Length; sub++)
                {
                    if (index != sub)
                    {
                        midSlotIndex = (index + sub) / 2;
                        //Debug.Log(_slotIter.Index + " " + Slots[midSlotIndex].Index + " " + Slots[sub].Index);
                        if (CanMove(_slotIter, Slots[midSlotIndex], Slots[sub]))
                        {
                            return(false);
                        }
                    }
                }
            }
        }

        return(true);
    }
Exemple #3
0
    void SlotClicked(EmptySlot slot)
    {
        int       midSlotIndex = (_currentPeg.Slot.Index + slot.Index) / 2;
        EmptySlot midSlot      = Slots[midSlotIndex];

        //Debug.Log("start index: " + _currentPeg.Slot.Index + " target index: " + slot.Index + " middle slot: " +  midSlotIndex);
        if (CanMove(_currentPeg.Slot, midSlot, slot))
        {
            _currentPeg.Slot.ClearPeg();
            slot.SetPeg(_currentPeg);

            _currentPeg.SetInactive();
            midSlot.ClearPeg();

            _pegCount--;

            if (_pegCount == PEGS_LEFT_TO_WIN)
            {
                EndGame(true);
            }
            else if (CheckForNoMoreMoves())
            {
                EndGame(false);
            }
        }
    }
 public ClampFLoat()
 {
     m_Input0 = CreateInputSlot <EmptySlot <float> >(0, "val");
     m_Input1 = CreateInputSlot <ValueSlot <float> >(1, "min").SetShowControl().SetValue(0);
     m_Input2 = CreateInputSlot <ValueSlot <float> >(2, "max").SetShowControl().SetValue(1);
     CreateOutputSlot <GetterSlot <float> >(3, "Out").SetGetter(Execute);
 }
 public ExecutionFilterNode()
 {
     m_Event = CreateInputSlot <EmptySlot <Action <UIEventData> > >("Event");
     m_Event.SetAllowMultipleConnections(true);
     m_Filter = CreateInputSlot <ValueSlot <bool> >("Filter").SetShowControl();
     CreateOutputSlot <DefaultValueSlot <Action <UIEventData> > >("UI Event").SetDefaultValue(Execute);
 }
 public NamespaceNode()
 {
     name    = "Namespace Declaration";
     m_Types = CreateInputSlot <EmptySlot <CodeTypeDeclaration> >("types", "Types (dec)");
     m_Types.allowMultipleConnections = true;
     m_Imports = CreateInputSlot <EmptySlot <CodeNamespaceImport> >("imports", "Imports");
     m_Imports.allowMultipleConnections = true;
 }
 public UIMasterNode()
 {
     name    = "UI Master Node";
     m_Input = CreateInputSlot <EmptySlot <Action <UIEventData> > >("UI Event");
     m_Input.SetAllowMultipleConnections(true);
     m_Rect   = CreateInputSlot <ValueSlot <Rect> >("Rect").SetShowControl();
     m_Matrix = CreateInputSlot <DefaultValueSlot <Matrix4x4> >("Matrix").SetDefaultValue(Matrix4x4.identity);
 }
 public TypeNode()
 {
     name          = "Type Declaration";
     m_TypeBuilder = CreateOutputSlot <GetterSlot <CodeTypeDeclaration> >("type", "Type (dec)").SetGetter(Build);
     m_Members     = CreateInputSlot <EmptySlot <CodeTypeMember> >("members", "Members (mem)");
     m_BaseTypes   = CreateInputSlot <EmptySlot <CodeTypeReference> >("baseTypes", "Base Types (ref)");
     m_Comments    = CreateInputSlot <EmptySlot <CodeCommentStatement> >("comments", "Comments (stm)");
     m_Members.allowMultipleConnections = true;
 }
Exemple #9
0
 public MethodNode()
 {
     name         = "Method Member";
     m_ReturnType = CreateInputSlot <CodeTypeReferenceSlot>("returnType", "ReturnType (ref)");
     m_ReturnType.SetValue("System.Void");
     m_Parameters = CreateInputSlot <EmptySlot <CodeParameterDeclarationExpression> >("parameters", "Parameters (dec exp)");
     m_Parameters.allowMultipleConnections = true;
     m_Statements = CreateInputSlot <EmptySlot <CodeStatement> >("statements", "Statements (stm)");
     m_Statements.allowMultipleConnections = true;
 }
 public UIElementNode()
 {
     m_Event = CreateInputSlot <EmptySlot <Action <UIEventData> > >("Event");
     m_Event.SetAllowMultipleConnections(true);
     m_Position  = CreateInputSlot <ValueSlot <Vector2> >("pos", "Position").SetShowControl();
     m_Size      = CreateInputSlot <ValueSlot <Vector2> >("size", "Size").SetValue(new Vector2(100, 100)).SetShowControl();
     m_OffsetMin = CreateInputSlot <ValueSlot <Vector2> >("minOffset", "Offset Min").SetShowControl();
     m_OffsetMax = CreateInputSlot <ValueSlot <Vector2> >("maxOffset", "Offset Max").SetShowControl();
     m_AnchorMin = CreateInputSlot <ValueSlot <Vector2> >("minAnchor", "Anchor Min %").SetValue(new Vector2(0.5f, 0.5f)).SetShowControl();
     m_AnchorMax = CreateInputSlot <ValueSlot <Vector2> >("maxAnchor", "Anchor Max %").SetValue(new Vector2(0.5f, 0.5f)).SetShowControl();
 }
 void Awake()
 {
     selectedSlot     = SlotLength;
     PassiveSkillList = new List <Skill>();
     DebuffList       = new List <Skill>();
     SlotList         = new EmptySlot[SlotLength];
     for (int i = 0; i < SlotLength; i++)
     {
         SlotList[i] = new EmptySlot();
     }
 }
Exemple #12
0
 public TextNode()
 {
     m_Text     = CreateInputSlot <ValueSlot <string> >("Text").SetShowControl();
     m_FontSize = CreateInputSlot <ValueSlot <int> >("Size").SetValue(DefaultFontSize).SetShowControl();
     m_Pivot    = CreateInputSlot <ValueSlot <Vector2> >("Pivot").SetShowControl();
     m_Color    = CreateInputSlot <ValueSlot <Color> >("Color").SetValue(Color.white).SetShowControl();
     m_Font     = CreateInputSlot <DefaultValueSlot <Font> >("Font");
     m_Matrix   = CreateInputSlot <DefaultValueSlot <Matrix4x4> >("Matrix").SetDefaultValue(Matrix4x4.identity);
     m_Material = CreateInputSlot <EmptySlot <Material> >("Material");
     CreateOutputSlot <ValueSlot <Action <UIEventData> > >("UI Event").SetValue(Execute);
     CreateOutputSlot <GetterSlot <Rect> >("Extents").SetGetter(() => m_TextGenerator.rectExtents);
 }
Exemple #13
0
    public void StartGame()
    {
        int index = 0;

        EmptySlot slot = null;

        for (index = 0; index < Slots.Length; index++)
        {
            slot          = Slots[index];
            slot.clicked += SlotClicked;
            slot.Index    = index;
        }

        Peg peg = null;

        _pegCount = 0;
        for (index = Slots.Length - 1; index > 0; index--)
        {
            peg          = Pegs[_pegCount];
            peg.clicked += PegClicked;
            Slots[index].SetPeg(peg);
            _pegCount++;
        }
    }
Exemple #14
0
    public void Restart()
    {
        int index = 0;

        EmptySlot slot = null;

        for (index = 0; index < Slots.Length; index++)
        {
            slot       = Slots[index];
            slot.Index = index;
            slot.ClearPeg();
        }

        Peg peg = null;

        _pegCount = 0;
        for (index = Slots.Length - 1; index > 0; index--)
        {
            peg = Pegs[_pegCount];
            peg.SetInactive();
            Slots[index].SetPeg(peg);
            _pegCount++;
        }
    }
 public MethodReferenceExpressionNode() : base("method", "Method (ref exp)")
 {
     name            = "Method Reference";
     m_Target        = CreateInputSlot <EmptySlot <CodeExpression> >("target", "Target (exp)");
     m_TypeArguments = CreateInputSlot <EmptySlot <CodeTypeReference> >("typeArguments", "Type Arguments (ref)");
 }
Exemple #16
0
 protected MultiplyNode()
 {
     m_Input0 = CreateInputSlot <EmptySlot <T> >("0");
     m_Input1 = CreateInputSlot <EmptySlot <T> >("1");
     CreateOutputSlot <GetterSlot <T> >("Out").SetGetter(MultiplyInternal);
 }
Exemple #17
0
 bool CanMove(EmptySlot startSlot, EmptySlot midSlot, EmptySlot target)
 {
     return(midSlot.HasPeg &&                                                                                                        //check if the middle index has a peg
            ((startSlot.RowIndex == target.RowIndex && Mathf.Abs(startSlot.IndexInRow - target.IndexInRow) == SEPARATION) ||         //check if they are in the same row and 2 separate
             (Mathf.Abs(startSlot.RowIndex - target.RowIndex) == SEPARATION && startSlot.IndexInRow % 2 == target.IndexInRow % 2))); //check if they are in separate rows which are 2 apart && are the same parity (even or odd)
 }
Exemple #18
0
 public MethodReturnStatementNode() : base("out", "Out (stm)")
 {
     name        = "Method Return";
     m_Expresion = CreateInputSlot <EmptySlot <CodeExpression> >("expression", "Exp (exp)");
 }
 public ObjectCreateExpressionNode() : base("out", "Object (exp)")
 {
     m_Type       = CreateInputSlot <CodeTypeReferenceSlot>("type", "Type");
     m_Parameters = CreateInputSlot <EmptySlot <CodeExpression> >("parameters", "Parameters");
     m_Parameters.allowMultipleConnections = true;
 }
Exemple #20
0
 public void SetSlot(EmptySlot slot)
 {
     _slot = slot;
 }
 public MultiplyFloat()
 {
     m_Input0 = CreateInputSlot <ValueSlot <float> >(0, "x").SetShowControl();
     m_Input1 = CreateInputSlot <EmptySlot <float> >(1, "y");
     CreateOutputSlot <GetterSlot <float> >(3, "Out").SetGetter(Execute);
 }
Exemple #22
0
 public FieldNode()
 {
     name            = "Field Member";
     m_VariableType  = CreateInputSlot <CodeTypeReferenceSlot>("type", "Type (ref)");
     m_InitExpresion = CreateInputSlot <EmptySlot <CodeExpression> >("init", "Init (exp)");
 }
Exemple #23
0
 public ExpressionStatementNode() : base("out", "This (stm)")
 {
     name         = "Expression Statement";
     m_Expression = CreateInputSlot <EmptySlot <CodeExpression> >("expression", "Exp (exp)");
 }
Exemple #24
0
 public To3DNode()
 {
     m_Input = CreateInputSlot <EmptySlot <Vector2> >("In");
     CreateOutputSlot <GetterSlot <Vector3> >("Out").SetGetter(() => m_Input[this]);
 }
Exemple #25
0
 protected MethodNode(string x, string o)
 {
     m_Input = CreateInputSlot <EmptySlot <TInput> >(0, x);
     CreateOutputSlot <GetterSlot <TOutput> >(1, o).SetGetter(ExecuteInternal);
 }
Exemple #26
0
    // Do your threaded task. DON'T use the Unity API here
    protected override void ThreadFunction()
    {
        /*
         * I could of split each type of generation into their own methods, but I just used regions instead :/
         */
        //The C# Random instance
        Random rnd = new Random(seed);

        //Set the size of the whole city
        citySlots = new GeneratedSlot[citySize, citySize];
        //Setting the list
        roads = new List <Road>();

        //Setting all the tiles first so we don't get any errors later on
        EmptySlot emptySlot = new EmptySlot();

        for (int x = 0; x < citySize; x++)
        {
            for (int y = 0; y < citySize; y++)
            {
                citySlots[x, y] = emptySlot;
            }
        }

        #region Motorway

        /*
         *
         * Motorway
         *
         */

        //Generate the one motorway from top to bottom
        int motorwayStartX = 20 + rnd.Next(citySize - 40); //Picks a random number from 0 to city size

        //The motorway is always going to be the size of the city
        Vector3[] points = new Vector3[citySize];

        //The first slot won't be connected to anything
        citySlots[motorwayStartX, 0] = new RoadSlot(RoadSlot.Type.M, 0);
        points[0] = new Vector3(motorwayStartX, 0, 0);
        //This for loop will go from top to bottom along the one x axis to create the motorway
        for (int i = 1; i < citySize; i++)
        {
            citySlots[motorwayStartX, i] = new RoadSlot(RoadSlot.Type.M, 0);
            points[i] = new Vector3(motorwayStartX, 0, i);
        }

        Road motorway = new Road(points, RoadType.M);

        roads.Add(motorway);
        #endregion

        #region A-Road

        /*
         *
         * A-Road
         *
         * Each side of the motorway there will be 3 different A roads unless
         * the motorway is less that the minium size for small houses
         */

        //Left side
        Vector3[] a1Points = new Vector3[motorwayStartX];
        Vector3[] a2Points = new Vector3[motorwayStartX];
        Vector3[] a3Points = new Vector3[motorwayStartX];

        //Right side
        Vector3[] a4Points = new Vector3[citySize - motorwayStartX];
        Vector3[] a5Points = new Vector3[citySize - motorwayStartX];
        Vector3[] a6Points = new Vector3[citySize - motorwayStartX];



        for (int i = 0; i < motorwayStartX; i++)
        {
            CheckSlotForRoad(motorwayStartX - i, 0, 0, 0, RoadSlot.Type.A, RoadSlot.Type.A, 90);
            a1Points[i] = new Vector3(motorwayStartX - i, 0, 0);

            CheckSlotForRoad(motorwayStartX - i, citySize / 2, 0, 0, RoadSlot.Type.A, RoadSlot.Type.A, 90);
            a2Points[i] = new Vector3(motorwayStartX - i, 0, citySize / 2);

            CheckSlotForRoad(motorwayStartX - i, citySize - 1, 0, 0, RoadSlot.Type.A, RoadSlot.Type.A, 90);
            a3Points[i] = new Vector3(motorwayStartX - i, 0, citySize - 1);
        }

        for (int i = 0; i < citySize - motorwayStartX; i++)
        {
            CheckSlotForRoad(motorwayStartX + i, 0, 0, 0, RoadSlot.Type.A, RoadSlot.Type.A, 90);
            a4Points[i] = new Vector3(motorwayStartX + i, 0, 0);

            CheckSlotForRoad(motorwayStartX + i, citySize / 2, 0, 0, RoadSlot.Type.A, RoadSlot.Type.A, 90);
            a5Points[i] = new Vector3(motorwayStartX + i, 0, citySize / 2);

            CheckSlotForRoad(motorwayStartX + i, citySize - 1, 0, 0, RoadSlot.Type.A, RoadSlot.Type.A, 90);
            a6Points[i] = new Vector3(motorwayStartX + i, 0, citySize - 1);
        }

        Road a1 = new Road(a1Points, RoadType.A);
        Road a2 = new Road(a2Points, RoadType.A);
        Road a3 = new Road(a3Points, RoadType.A);
        Road a4 = new Road(a4Points, RoadType.A);
        Road a5 = new Road(a5Points, RoadType.A);
        Road a6 = new Road(a6Points, RoadType.A);

        roads.Add(a1);
        roads.Add(a2);
        roads.Add(a3);
        roads.Add(a4);
        roads.Add(a5);
        roads.Add(a6);

        #endregion

        #region S-Road Housing

        /*
         *
         * Side Road Housing
         *
         *
         */

        //These two roads are the roads we are going to be finding the random points off of
        Road leftStraightRoad  = a1;
        Road rightStraightRoad = a4;
        int  amountOfSideRoads = rnd.Next(0, 5); //This number will be used to how many random points we find



        for (int i = 0; i < (citySize / 2) - 2; i += 2)
        {
            Vector3[] leftRoadPoints  = new Vector3[motorwayStartX - 2]; //There is some overflow here, not sure why
            Vector3[] rightRoadPoints = new Vector3[citySize - motorwayStartX - 2];

            Vector2[] leftRandomPoints  = new Vector2[amountOfSideRoads];
            Vector2[] rightRandomPoints = new Vector2[amountOfSideRoads];

            //First find the random points that we want to use
            for (int j = 0; j < amountOfSideRoads; j++)
            {
                //This will give a random point of the points list to pick from
                int leftPoint  = rnd.Next(leftStraightRoad.points.Length - 1);
                int rightPoint = rnd.Next(rightStraightRoad.points.Length - 1);

                Vector2 leftVector2  = leftStraightRoad.points[leftPoint + 1];
                Vector2 rightVector2 = rightStraightRoad.points[rightPoint + 1];

                leftRandomPoints[j]  = leftVector2;
                rightRandomPoints[j] = rightVector2;
            }


            //Loop for the whole length that the road needs to be
            for (int j = 0; j < citySize - motorwayStartX - 2; j++)
            {
                int x = motorwayStartX + j + 2;
                int y = i + 2;

                RoadSlot rightSlot = new RoadSlot(RoadSlot.Type.S, 90);
                rightRoadPoints[j] = new Vector3(x, 0, y);
                for (int k = 0; k < rightRandomPoints.Length; k++)
                {
                    if (rightRandomPoints[k].x == x)
                    {
                        rightSlot.AddConnection(x, y - 1, RoadSlot.Type.S);

                        //There should be the road we had done before in this slot, so we are just adding a connection
                        CheckSlotForRoad(x, i, x, i + 1, RoadSlot.Type.S, RoadSlot.Type.S, 90);

                        RoadSlot middleSlot = new RoadSlot(RoadSlot.Type.S, 0);
                        citySlots[x, y - 1] = middleSlot;

                        Vector3[] smallRoadPoints = new Vector3[3];
                        smallRoadPoints[0] = new Vector3(x, 0, y);
                        smallRoadPoints[1] = new Vector3(x, 0, y - 1);
                        smallRoadPoints[2] = new Vector3(x, 0, i);
                        roads.Add(new Road(smallRoadPoints, RoadType.S));

                        //Rotating the bottom S road
                        if (citySlots[x, i] is RoadSlot)
                        {
                            if (((RoadSlot)citySlots[x, i]).type == RoadSlot.Type.S)
                            {
                                ((RoadSlot)citySlots[x, i]).primaryDirection += 180;
                            }
                        }
                        break;
                    }
                    else
                    {
                        //If there is no road joining the two straight lines, this should be a building
                        citySlots[x, y - 1] = new BuildingSlot();
                    }
                }

                citySlots[x, y] = rightSlot;
            }

            for (int j = 0; j < motorwayStartX - 2; j++)
            {
                int x = motorwayStartX - j - 2;
                int y = i + 2;

                RoadSlot leftSlot = new RoadSlot(RoadSlot.Type.S, 90);
                leftRoadPoints[j] = new Vector3(x, 0, y);
                for (int k = 0; k < leftRandomPoints.Length; k++)
                {
                    if (leftRandomPoints[k].x == x)
                    {
                        leftSlot.AddConnection(x, y - 1, RoadSlot.Type.S);

                        //There should be the road we had done before in this slot, so we are just adding a connection
                        CheckSlotForRoad(x, i, x, i + 1, RoadSlot.Type.S, RoadSlot.Type.S, 90);

                        RoadSlot middleSlot = new RoadSlot(RoadSlot.Type.S, 0);
                        citySlots[x, y - 1] = middleSlot;

                        Vector3[] smallRoadPoints = new Vector3[3];
                        smallRoadPoints[0] = new Vector3(x, 0, y);
                        smallRoadPoints[1] = new Vector3(x, 0, y - 1);
                        smallRoadPoints[2] = new Vector3(x, 0, i);
                        roads.Add(new Road(smallRoadPoints, RoadType.S));

                        //Rotating the bottom S road
                        if (citySlots[x, i] is RoadSlot)
                        {
                            if (((RoadSlot)citySlots[x, i]).type == RoadSlot.Type.S)
                            {
                                ((RoadSlot)citySlots[x, i]).primaryDirection += 180;
                            }
                        }
                        break;
                    }
                    else
                    {
                        //If there is no road joining the two straight lines, this should be a building
                        citySlots[x, y - 1] = new BuildingSlot();
                    }
                }

                citySlots[x, y] = leftSlot;
            }

            Road left  = new Road(leftRoadPoints, RoadType.S);
            Road right = new Road(rightRoadPoints, RoadType.S);

            leftStraightRoad  = left;
            rightStraightRoad = right;

            roads.Add(left);
            roads.Add(right);
        }

        //Connecting the the middle A roads

        Vector2[] leftLastRandomPoints  = new Vector2[amountOfSideRoads];
        Vector2[] rightLastRandomPoints = new Vector2[amountOfSideRoads];

        for (int i = 0; i < amountOfSideRoads; i++)
        {
            Vector3[] leftPoints  = new Vector3[3];
            Vector3[] rightPoints = new Vector3[3];

            //This will give a random point of the points list to pick from
            int leftPoint  = rnd.Next(leftStraightRoad.points.Length);
            int rightPoint = rnd.Next(rightStraightRoad.points.Length);

            leftPoints[0] = new Vector3(leftStraightRoad.points[leftPoint].x, 0, (citySize / 2) - 2);
            leftPoints[1] = new Vector3(leftStraightRoad.points[leftPoint].x, 0, (citySize / 2));
            leftPoints[2] = new Vector3(leftStraightRoad.points[leftPoint].x, 0, (citySize / 2));

            rightPoints[0] = new Vector3(rightStraightRoad.points[rightPoint].x, 0, (citySize / 2) - 2);
            rightPoints[1] = new Vector3(rightStraightRoad.points[rightPoint].x, 0, (citySize / 2) - 1);
            rightPoints[2] = new Vector3(rightStraightRoad.points[rightPoint].x, 0, (citySize / 2));

            //These float should already be a whole number anyways
            int rightX = Mathf.RoundToInt(rightPoints[0].x);
            int leftX  = Mathf.RoundToInt(leftPoints[0].x);
            int y      = Mathf.RoundToInt(leftStraightRoad.points[0].z);

            //Adding it to the slot array
            CheckSlotForRoad(rightX, y, rightX, y + 1, RoadSlot.Type.S, RoadSlot.Type.S, 180);
            CheckSlotForRoad(rightX, y + 1, 0, 0, RoadSlot.Type.S, RoadSlot.Type.S, 0);
            CheckSlotForRoad(rightX, y + 2, rightX, y + 1, RoadSlot.Type.S, RoadSlot.Type.S, 180);

            CheckSlotForRoad(leftX, y, leftX, y + 1, RoadSlot.Type.S, RoadSlot.Type.S, 180);
            CheckSlotForRoad(leftX, y + 1, 0, 0, RoadSlot.Type.S, RoadSlot.Type.S, 0);
            CheckSlotForRoad(leftX, y + 2, leftX, y + 1, RoadSlot.Type.S, RoadSlot.Type.S, 180);

            //Having to do some manual correction as CheckSlotsForRoad has a flaw
            ((RoadSlot)citySlots[leftX, y]).primaryDirection     = 270;
            ((RoadSlot)citySlots[leftX, y + 2]).primaryDirection = 270;

            ((RoadSlot)citySlots[rightX, y]).primaryDirection     = 270;
            ((RoadSlot)citySlots[rightX, y + 2]).primaryDirection = 270;

            Road leftSmallRoad  = new Road(leftPoints, RoadType.S);
            Road rightSmallRoad = new Road(rightPoints, RoadType.S);

            roads.Add(leftSmallRoad);
            roads.Add(rightSmallRoad);
        }
        #endregion

        #region S-Road Factories

        /*
         *
         * S-Road Factories
         *
         * The way the roads are going to generate will be based of a fixed size
         * So for every 10 units, we place a road then inside of that 10 units we would spawn the prefab for the factory
         * if there is less that 10 units left we just stop
         *
         * If there is less than 10 units on the whole side we just leave that side.
         */

        //First we want to work out how many times we can move along on one side
        //
        float factorySize       = 4;
        int   leftFactoryRoads  = Mathf.FloorToInt(motorwayStartX / factorySize);
        int   rightFactoryRoads = Mathf.FloorToInt((citySize - motorwayStartX) / factorySize);
        citySlots[motorwayStartX + 1, (citySize / 2) + 1] = new FactorySlot(true, true);
        citySlots[motorwayStartX - 1, (citySize / 2) + 1] = new FactorySlot(true, false);

        //Left side
        for (int i = 1; i <= leftFactoryRoads; i++)
        {
            int roadX    = Mathf.RoundToInt(motorwayStartX - (factorySize * i));
            int distance = citySize / 2 - 2;
            //For the distance between the middle road and the top road, we create a straight line on x
            Vector3[] currentRoadPoints = new Vector3[distance]; //This should be half the size

            CheckSlotForRoad(roadX, citySize / 2, roadX, citySize / 2, RoadSlot.Type.S, RoadSlot.Type.S, 0);

            for (int j = 0; j < distance; j++)
            {
                int y = j + citySize / 2 + 1;
                currentRoadPoints[j] = new Vector3(roadX, 0, y);

                citySlots[roadX, y] = new RoadSlot(RoadSlot.Type.S, 0);

                //Every 4
                if (j % 2 == 0 && roadX - 1 > 0)
                {
                    //Adding the factory spawn
                    citySlots[roadX - 1, y] = new FactorySlot(true, false);
                }
            }

            Road currentRoad = new Road(currentRoadPoints, RoadType.S);
            roads.Add(currentRoad);
        }

        //Right Side
        for (int i = 1; i <= rightFactoryRoads; i++)
        {
            int roadX    = Mathf.RoundToInt(motorwayStartX + (factorySize * i));
            int distance = citySize / 2 - 2;
            //For the distance between the middle road and the top road, we create a straight line on x
            Vector3[] currentRoadPoints = new Vector3[distance]; //This should be half the size

            CheckSlotForRoad(roadX, citySize / 2, roadX, citySize / 2, RoadSlot.Type.S, RoadSlot.Type.S, 0);
            for (int j = 0; j < distance; j++)
            {
                int y = j + citySize / 2 + 1;
                currentRoadPoints[j] = new Vector3(roadX, 0, y);

                citySlots[roadX, y] = new RoadSlot(RoadSlot.Type.S, 0);

                //Every 4
                if (j % 2 == 0 && roadX + 1 < 100)
                {
                    //Adding the factory spawn
                    citySlots[roadX + 1, y] = new FactorySlot(true, true);
                }
            }

            Road currentRoad = new Road(currentRoadPoints, RoadType.S);
            roads.Add(currentRoad);
        }

        //This does a for loop coving anything which isn't a road in the factory area
        for (int x = 0; x < citySize; x++)
        {
            for (int y = 0; y < (citySize / 2) - 2; y++)
            {
                if (citySlots[x, y + ((citySize / 2) + 1)] is EmptySlot)
                {
                    citySlots[x, y + ((citySize / 2) + 1)] = new FactorySlot();
                }
            }
        }

        #endregion
    }
Exemple #27
0
 public CastExpressionNode() : base("out", "Cast (exp)")
 {
     m_Type       = CreateInputSlot <CodeTypeReferenceSlot>("type", "Type (ref)");
     m_Expression = CreateInputSlot <EmptySlot <CodeExpression> >("exp", "Cast (exp)");
 }
Exemple #28
0
 public EmptyWrapper(EmptySlot emptySlot) : base()
 {
     this._emptySlot = emptySlot;
 }
 public FieldReferenceExpressionNode() : base("out", "Out (ref exp)")
 {
     name     = "Field Reference";
     m_Target = CreateInputSlot <EmptySlot <CodeExpression> >("target", "Target (exp)");
 }