Пример #1
0
    public void SetActiveFoundation(string prototype)
    {
        activeFoundation = GridData.GetFoundationPrototype(prototype);
        creationMode     = CreationMode.Foundation;

        UpdateToolInfo(activeFoundation.instructionSetID);
    }
Пример #2
0
    public static FoundationData Prototype(string instructionSetID)
    {
        FoundationData newData = new FoundationData();

        newData.instructionSetID = instructionSetID;

        return(newData);
    }
Пример #3
0
    public static FoundationData Instantiate(FoundationData prototype, CellData cell)
    {
        if (prototype != null)
        {
            FoundationData newData = new FoundationData();

            newData.instructionSetID = prototype.instructionSetID;
            newData.cellData         = cell;
            cell.foundation          = newData;

            return(newData);
        }

        cell.foundation = null;
        return(null);
    }
Пример #4
0
    public void Initialize()
    {
        dragStartPosition = Metrics.nullVector3;
        dragStartCell     = null;

        dragEndPosition = Metrics.nullVector3;
        dragEndCell     = null;

        defaultMegaMaterial = (int)MatI.Boards;
        defaultMegaColor    = (int)ColI.Brown;
        defaultElevation    = 1;
        defaultFoundation   = GridData.GetFoundationPrototype(PStrings.ground);

        editorUI = GetComponent <GridEditorUI>();
        ToggleGrid(false);

        SetActiveDirection((int)Direction.S);
        SetActiveEffect((int)EffectMode.Grass);
        SetActiveColor((int)ColI.Grey);
        SetActiveMegaMaterial((int)MatI.Bricks);
        SetActiveElevation(defaultElevation);
        SetActiveStructure(PStrings.wall);
    }
Пример #5
0
    private void SelectAt(CellData cell)
    {
        if (selectionMode == SelectionMode.Null)
        {
            //////////////////////////////////////////////////////////////////////////////////////
            /// This should never happen but if it does nothing should be created or destroyed ///
            //////////////////////////////////////////////////////////////////////////////////////
        }
        else if (selectionMode == SelectionMode.Obstacle)
        {
            if (inputMode == InputMode.Null)
            {
                //////////////////////////////////////////////////////////////////////////////////////
                /// This should never happen but if it does nothing should be created or destroyed ///
                //////////////////////////////////////////////////////////////////////////////////////
            }
            else if (inputMode == InputMode.Constructive)
            {
                SetSelectedObstacle(cell.obstacle);
            }
            else if (inputMode == InputMode.Destructive)
            {
                SetSelectedObstacle(null);
            }
        }
        else if (selectionMode == SelectionMode.Item)
        {
            if (inputMode == InputMode.Null)
            {
                //////////////////////////////////////////////////////////////////////////////////////
                /// This should never happen but if it does nothing should be created or destroyed ///
                //////////////////////////////////////////////////////////////////////////////////////
            }
            else if (inputMode == InputMode.Constructive)
            {
                SetSelectedItem(cell.item);
            }
            else if (inputMode == InputMode.Destructive)
            {
                SetSelectedItem(null);
            }
        }
        else if (selectionMode == SelectionMode.Entity)
        {
            if (inputMode == InputMode.Null)
            {
                //////////////////////////////////////////////////////////////////////////////////////
                /// This should never happen but if it does nothing should be created or destroyed ///
                //////////////////////////////////////////////////////////////////////////////////////
            }
            else if (inputMode == InputMode.Constructive)
            {
                SetSelectedEntity(cell.entity);
            }
            else if (inputMode == InputMode.Destructive)
            {
                SetSelectedEntity(null);
            }
        }
        else if (selectionMode == SelectionMode.Effect)
        {
            if (inputMode == InputMode.Null)
            {
                //////////////////////////////////////////////////////////////////////////////////////
                /// This should never happen but if it does nothing should be created or destroyed ///
                //////////////////////////////////////////////////////////////////////////////////////
            }
            else if (inputMode == InputMode.Constructive)
            {
                if (effectMode == EffectMode.Null)
                {
                    /////////////////////////////////////////////////////////////////////////
                    /// This should never happen but if it does nothing should be changed ///
                    /////////////////////////////////////////////////////////////////////////
                }
                else if (effectMode == EffectMode.Grass && FoundationData.ValidateHasGrass(cell) == true)
                {
                    if (editColor == true)
                    {
                        cell.foundation.effectColorIndex = activeColor;
                    }
                }
                else if (effectMode == EffectMode.Fog && FoundationData.ValidateHasFog(cell) == true)
                {
                    if (editColor == true)
                    {
                        cell.foundation.effectColorIndex = activeColor;
                    }
                }
                else if (effectMode == EffectMode.Liquid && FoundationData.ValidateHasLiquid(cell) == true)
                {
                    if (editColor == true)
                    {
                        cell.foundation.effectColorIndex = activeColor;
                    }
                }
            }
            else if (inputMode == InputMode.Destructive)
            {
                if (effectMode == EffectMode.Null)
                {
                    /////////////////////////////////////////////////////////////////////////
                    /// This should never happen but if it does nothing should be changed ///
                    /////////////////////////////////////////////////////////////////////////
                }
                else if (effectMode == EffectMode.Grass && FoundationData.ValidateHasGrass(cell) == true)
                {
                    if (editColor == true)
                    {
                        cell.foundation.effectColorIndex = (int)ColI.Green;
                    }
                }
                else if (effectMode == EffectMode.Fog && FoundationData.ValidateHasFog(cell) == true)
                {
                    if (editColor == true)
                    {
                        cell.foundation.effectColorIndex = (int)ColI.Red;
                    }
                }
                else if (effectMode == EffectMode.Liquid && FoundationData.ValidateHasLiquid(cell) == true)
                {
                    if (editColor == true)
                    {
                        cell.foundation.effectColorIndex = (int)ColI.Blue;
                    }
                }
            }
        }
        else if (selectionMode == SelectionMode.Waypoint)
        {
            if (inputMode == InputMode.Null)
            {
                //////////////////////////////////////////////////////////////////////////////////////
                /// This should never happen but if it does nothing should be created or destroyed ///
                //////////////////////////////////////////////////////////////////////////////////////
            }
            else if (inputMode == InputMode.Constructive)
            {
                SetSelectedWaypoint(cell);
            }
            else if (inputMode == InputMode.Destructive)
            {
                SetSelectedWaypoint(cell);

                selectedWaypoint = null;
            }
        }
    }
Пример #6
0
 void Start()
 {
     foundData = GameObject.Find("DataHolder").GetComponent <FoundationData> ();
     StartCoroutine(mainCoroutine());
 }
Пример #7
0
 public static void InstantiateFoundation(FoundationData prototype, CellData cell)
 {
     FoundationData.Instantiate(prototype, cell);
     PathGrid.Invalidate();
 }
Пример #8
0
 private static void BuildFoundationPrototype(string id)
 {
     foundationPrototypes.Add(id, FoundationData.Prototype(id));
 }