Exemplo n.º 1
0
 public void Depopulate()
 {
     transform.Find("Image").GetComponent <Image>().enabled      = false;
     transform.Find("Bottom Text").GetComponent <Text>().enabled = false;
     transform.Find("Rank Text").GetComponent <Text>().enabled   = false;
     VLocal = null;
 }
Exemplo n.º 2
0
    public void Populate(VectorLocal v)
    {
        VLocal = v;
        Image i = transform.Find("Image").GetComponent <Image>();

        i.sprite  = getSprite();
        i.enabled = true;
        Text t = transform.Find("Bottom Text").GetComponent <Text>();

        t.enabled = true;
        switch (mode)
        {
        case VectorTileDisplayMode.name:
            t.text = DataManager.CoreLibrary[VLocal.Core].name;
            break;

        case VectorTileDisplayMode.level:
            t.text = "Lv " + VLocal.Level;
            break;

        case VectorTileDisplayMode.rank:
            t.text = "Rank " + VLocal.Rank;
            break;
        }

        t         = transform.Find("Rank Text").GetComponent <Text>();
        t.enabled = true;
        t.text    = "";
        for (int j = 0; j < VLocal.Rank; j++)
        {
            t.text += "★";
        }
    }
Exemplo n.º 3
0
    public static GameObject Create(VectorLocal v, Vector2 position, Transform parent)
    {
        GameObject g = (GameObject)Instantiate(Resources.Load("Interface/Vector Tile"), new Vector3(position.x, position.y, 0), Quaternion.identity);

        g.GetComponent <VectorTile>().Populate(v);
        g.transform.SetParent(parent, false);
        return(g);
    }
Exemplo n.º 4
0
 public static VectorSlot whatSlotIsVectorAssigned(VectorLocal vlocal)
 {
     foreach (VectorSlot vs in FindObjectsOfType <VectorSlot>())
     {
         if (vs.GetComponent <VectorTile>().VLocal == vlocal)
         {
             return(vs);
         }
     }
     return(null);
 }
Exemplo n.º 5
0
 public static bool isVectorAssignedAnySlot(VectorLocal vlocal)
 {
     foreach (VectorSlot vs in FindObjectsOfType <VectorSlot>())
     {
         if (vs.GetComponent <VectorTile>().VLocal == vlocal)
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 6
0
    public void init(VectorLocal local, VectorBehavior behavior)
    {
        VectorCore core = DataManager.CoreLibrary[local.Core];

        this.Name     = core.name;
        this.BaseHP   = core.hp;
        this.BasePow  = core.pow;
        this.BaseMag  = core.mag;
        this.BaseCon  = core.con;
        this.BaseRes  = core.res;
        this.BaseSpd  = core.spd;
        this.BaseMov  = core.mov;
        this.Behavior = behavior;
    }
Exemplo n.º 7
0
    public void Click()
    {
        // Variables:
        // Is there a tile currently selected?
        bool selectionExists = selected;
        // Is the tile that's selected a slot?
        bool selectionIsSlot = selectionExists && selected.GetComponent <VectorSlot>();
        // Is the vectorLocal in the selection in a slot?
        bool selectionVLocalAssignedToSlot = selectionExists && VectorSlot.isVectorAssignedAnySlot(selected.VLocal);
        // Are any slots open?
        bool anySlotsOpen = VectorSlot.AnySlotsOpen();
        // Is the tile that's clicked a slot?
        bool clickedIsSlot = GetComponent <VectorSlot>();
        // Is the vectorLocal in the tile that's clicked in a slot?
        bool clickedVLocalAssignedToSlot = VectorSlot.isVectorAssignedAnySlot(this.VLocal);
        // Is the vectorLocal in the tile that's clicked a match for the selection vectorLocal?
        bool clickedVLocalMatchesSelectionVLocal = selectionExists && (this.VLocal == selected.VLocal);

        if (!selectionExists)
        {
            if (!clickedIsSlot)
            {
                if (anySlotsOpen && !clickedVLocalAssignedToSlot)
                {
                    VectorSlot.NextSlotOpen(true).GetComponent <VectorTile>().Populate(this.VLocal);
                    FindObjectOfType <SquadAssignment>().SaveSquad();
                    return;
                }
                else
                {
                    Select();
                    return;
                }
            }
            else
            {
                Select();
                return;
            }
        }
        else
        {
            if (clickedVLocalMatchesSelectionVLocal)
            {
                Deselect();
                return;
            }
            else
            {
                if (selectionIsSlot)
                {
                    if (clickedIsSlot)
                    {
                        Select();
                        return;
                    }
                    else
                    {
                        if (clickedVLocalAssignedToSlot)
                        {
                            VectorTile  tileA = VectorSlot.whatSlotIsVectorAssigned(this.VLocal).GetComponent <VectorTile>();
                            VectorTile  tileB = VectorSlot.whatSlotIsVectorAssigned(selected.VLocal).GetComponent <VectorTile>();
                            VectorLocal tmp   = tileA.VLocal;
                            tileA.Populate(tileB.VLocal);
                            tileB.Populate(tmp);
                            Deselect();
                            FindObjectOfType <SquadAssignment>().SaveSquad();
                            return;
                        }
                        else
                        {
                            selected.Populate(this.VLocal);
                            Deselect();
                            FindObjectOfType <SquadAssignment>().SaveSquad();
                            return;
                        }
                    }
                }
                else
                {
                    if (clickedIsSlot)
                    {
                        if (selectionVLocalAssignedToSlot)
                        {
                            VectorTile  tileA = VectorSlot.whatSlotIsVectorAssigned(this.VLocal).GetComponent <VectorTile>();
                            VectorTile  tileB = VectorSlot.whatSlotIsVectorAssigned(selected.VLocal).GetComponent <VectorTile>();
                            VectorLocal tmp   = tileA.VLocal;
                            tileA.Populate(tileB.VLocal);
                            tileB.Populate(tmp);
                            Deselect();
                            FindObjectOfType <SquadAssignment>().SaveSquad();
                            return;
                        }
                        else
                        {
                            VectorSlot.whatSlotIsVectorAssigned(this.VLocal).GetComponent <VectorTile>().Populate(selected.VLocal);
                            Deselect();
                            FindObjectOfType <SquadAssignment>().SaveSquad();
                            return;
                        }
                    }
                    else
                    {
                        Select();
                        return;
                    }
                }
            }
        }
    }