Exemplo n.º 1
0
 public void passInData(Slot[] myFriendst, Slot[] myEnemiest, bUnit met, int index)
 {
     myFriends = myFriendst;
     myEnemies = myEnemiest;
     me        = met;
     myIndex   = index;
 }
Exemplo n.º 2
0
 public void spawnAtSlot(bUnit unit, Slot sl)
 {
     if (unit != null)
     {
         sl.assignUnit(unit);
     }
 }
Exemplo n.º 3
0
    /*void OnMouseEnter()
     * {
     *  mouseOverFunc();
     * }*/

    public void assignUnit(bUnit unit)
    {
        if (myUnitMesh == null)
        {
            myUnitMesh = transform.GetChild(0).GetComponent <UnitMesh>();
            myUnitMesh.transform.localScale = new Vector3(.5f, .5f, .5f);
        }
        myUnitMesh.gameObject.SetActive(true);


        storedUnit = unit;

        myUnitMesh.myUnit = unit;
        myUnitMesh.initUnitRenderComponents();
        myUnitMesh.myMarketSlot = this;

        if (!isInvSlot)
        {
            if (myCostIcon == null)
            {
                myCostIcon = transform.GetChild(1).gameObject;
            }
            myCostIcon.SetActive(true);
            myCostIcon.transform.GetChild(0).GetComponent <TextMesh>().text = "" + unit.curBuyCost;
        }
    }
Exemplo n.º 4
0
 bUnit[] unitMeshListToUnitList(List <UnitMesh> ls)
 {
     bUnit[] ret = new bUnit[ls.Count];
     for (int i = 0; i < ls.Count; i++)
     {
         ret[i] = ls[i].myUnit;
     }
     return(ret);
 }
Exemplo n.º 5
0
 public void placeFriendlyAt(int index, bUnit unit)
 {
     if (index < 0 || index > friendlyUnitsOnBoard.Length)
     {
         Debug.Log("ERROR: Bad place index " + index + " for friendly unit. Crash imminent.");
         return;
     }
     friendlyUnitsOnBoard[index] = unit;
 }
Exemplo n.º 6
0
    // Start is called before the first frame update
    void Start()
    {
        st = GameObject.FindGameObjectWithTag("stats").GetComponent <gStats>();

        ctrl = 0;
        friendlyUnitCount       = 0;
        enemyUnitCount          = 0;
        timer                   = 0;
        curAttackersHighlighted = false;
        playerTurn              = true;
        curPhase                = GamePhase.Prep;
        selected                = null;
        typeToAssign            = null;

        //material control for combatants
        sub1orig = null;
        sub2orig = null;

        ih = GameObject.Find("InventoryController").GetComponent <InventoryHandler>();

        mk = GameObject.Find("MarketController").GetComponent <MarketController>();

        arrow = GameObject.FindGameObjectWithTag("indicator");

        lg = gameObject.GetComponent <LevelGenerator>();

        levelCount = 0;
        //uic = GameObject.Find("CTRLPanel").GetComponent<ActiveUIController>();
        //mk.initMarketPhase(testLevel);

        //DontDestroyOnLoad(gameObject);

        startingDifficulty = 5f;
        curDifficulty      = startingDifficulty;
        if (!st.isInfinite)
        {
            int temp = 0;
        }
        else
        {
            ctrl += startingCtrlBoost;
            //GameObject.Find("TutorialPanel").SetActive(false);
            //FOR SOME REASON, IF I JUST DISABLE THE TUTORIAL PANEL THEN UNITSELECTPANEL MOVES TWICE AS MUCH
            //WHEN EXPANDING.
            //TODO: FIGURE OUT WHY THE F**K AND REMOVE THIS SHITTY ASS SOLUTION BELOW.
            Color      setTo  = new Color(0, 0, 0, 0);
            GameObject target = GameObject.Find("TutorialPanel");
            target.GetComponent <Image>().color = setTo;
            target.transform.GetChild(0).GetComponent <Text>().color             = setTo;
            target.transform.GetChild(1).GetComponent <Image>().color            = setTo;
            target.transform.GetChild(1).GetChild(0).GetComponent <Text>().color = setTo;
            target.transform.GetChild(2).GetComponent <Image>().color            = setTo;
            target.transform.GetChild(2).GetChild(0).GetComponent <Text>().color = setTo;
        }
    }
Exemplo n.º 7
0
    public void addToInv(bUnit unit)
    {
        //unitInventory.Add(unit);

        /*GameObject temp = Instantiate(basicUnit, new Vector3(100, 100, 100), Quaternion.identity);
         * temp.GetComponent<Unit>().copyIn(unit);
         * unitInventory.Add(temp.GetComponent<Unit>());*/

        unitInventory.Add(unit);

        //addToBackupInv(unit);
    }
Exemplo n.º 8
0
 public void leftMouseSlotFunc(Slot sl)
 {
     if (sl.gameObject.tag == "FriendSlot" && curPhase == GamePhase.Prep && sl.myUnit == null && typeToAssign != null)
     {
         spawnAtSlot(typeToAssign, sl);
         sl.myUnit.isFriendly = true;
         ih.removeFromInv(typeToAssign);
         refreshUnitButtons();
         typeToAssign = null;
         sl.myUnitMesh.initAnimation();
         friendlyUnitCount++;
     }
 }
Exemplo n.º 9
0
 public override void onAtk(int targetIndex)
 {
     if (targetIndex > 0 && myEnemies[targetIndex - 1].myUnit != null)
     {
         bUnit potUnit = myEnemies[targetIndex - 1].myUnit;
         potUnit.atkDamage(me.curAtk);
     }
     if (targetIndex < myEnemies.Length - 1 && myEnemies[targetIndex + 1].myUnit != null)
     {
         bUnit potUnit = myEnemies[targetIndex + 1].myUnit;
         potUnit.atkDamage(me.curAtk);
     }
 }
Exemplo n.º 10
0
    public void assignUnit(bUnit unit)
    {
        if (myUnitMesh == null)
        {
            myUnitMesh = transform.GetChild(0).GetComponent <UnitMesh>();
            //myUnitMesh.transform.localScale = new Vector3(.5f, .5f, .5f);
        }
        myUnitMesh.gameObject.SetActive(true);

        myUnit = unit;

        myUnitMesh.myUnit = unit;
        myUnitMesh.initUnitRenderComponents();
        myUnitMesh.mySlot = this;
    }
Exemplo n.º 11
0
    void executeAttack()
    {
        bUnit sub1unit = trueSub1.GetComponent <UnitMesh>().myUnit;
        bUnit sub2unit = trueSub2.GetComponent <UnitMesh>().myUnit;



        sub1unit.atkDamage(sub2unit.curAtk);
        //STORE INDEX IN METADATA
        sub1unit.myData.onAtk(sub2unit.myData.myIndex);
        sub2unit.atkDamage(sub1unit.curAtk);
        sub2unit.myData.onHitBy(sub1unit.myData.myIndex);



        if (sub1unit.isDead())
        {
            sub1unit.myData.onDeath();
        }
        if (sub2unit.isDead())
        {
            sub2unit.myData.onDeath();
        }

        trueSub1.GetComponent <UnitMesh>().refreshText();
        trueSub2.GetComponent <UnitMesh>().refreshText();


        if (sub2unit.isDead())
        {
            emptySlot(trueSub2.GetComponent <UnitMesh>().mySlot);
        }
        if (sub1unit.isDead())
        {
            emptySlot(trueSub1.GetComponent <UnitMesh>().mySlot);
        }

        restoreMats(trueSub1, trueSub2);

        playerTurn = !playerTurn;
        curAttackersHighlighted = false;
        refreshMetaData();

        arrow.transform.position = new Vector3(100, 100, 100);
    }
Exemplo n.º 12
0
 public void emptyUnit()
 {
     storedUnit = null;
     myUnitMesh.gameObject.SetActive(false);
     myCostIcon.SetActive(false);
 }
Exemplo n.º 13
0
 public void addToInv(bUnit unit)
 {
     invSlots[curInvCount].assignUnit(unit);
     curInvCount++;
 }
Exemplo n.º 14
0
 public void removeFromInv(bUnit unit)
 {
     unitInventory.Remove(unit);
 }
Exemplo n.º 15
0
 public void emptyUnit()
 {
     myUnitMesh.gameObject.SetActive(false);
     myUnit = null;
 }