public void passInData(Slot[] myFriendst, Slot[] myEnemiest, bUnit met, int index) { myFriends = myFriendst; myEnemies = myEnemiest; me = met; myIndex = index; }
public void spawnAtSlot(bUnit unit, Slot sl) { if (unit != null) { sl.assignUnit(unit); } }
/*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; } }
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); }
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; }
// 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; } }
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); }
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++; } }
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); } }
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; }
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); }
public void emptyUnit() { storedUnit = null; myUnitMesh.gameObject.SetActive(false); myCostIcon.SetActive(false); }
public void addToInv(bUnit unit) { invSlots[curInvCount].assignUnit(unit); curInvCount++; }
public void removeFromInv(bUnit unit) { unitInventory.Remove(unit); }
public void emptyUnit() { myUnitMesh.gameObject.SetActive(false); myUnit = null; }