private static void CreateMonsters() // Just because i want random kind of monsters, in different lvls i go through this loop. And the settings gives them random lvls and names. { for (int i = 0; i < 15; i++) { Dragon dragon = new Dragon(); fireMonsters.Add(dragon); Demon demon = new Demon(); fireMonsters.Add(demon); Tortoise tortoise = new Tortoise(); waterMonsters.Add(tortoise); SwampTroll troll = new SwampTroll(); waterMonsters.Add(troll); Crocodile croc = new Crocodile(); waterMonsters.Add(croc); RabiesBear bear = new RabiesBear(); grassMonsters.Add(bear); Wasp wasp = new Wasp(); grassMonsters.Add(wasp); Scarab scarab = new Scarab(); grassMonsters.Add(scarab); } DragonLord dL = new DragonLord(); // but only one dragon lord. fireMonsters.Add(dL); }
// player has chosen a die public void ChooseDie(PharoahDie die) { pgs.UndoState(); // go back to previous state before WaitingToSelectDie bool bSuccessfulDieChosen = pgs.ChooseDie(die); // calls OnDieSelect delegate. For scarabs, this will reroll or addpip. For TileAbility, it will call the ability's delegate, if any if (bSuccessfulDieChosen) { // this should be made generic for all TileAbility if (this.curScarabInUse && this.curScarabInUse.isConsumed) { Destroy(this.curScarabInUse.gameObject); // destroy the scarab after we've rolled/added pip to the die. this.curScarabInUse = null; } // This will fire the trigger from the player's point of view. The die chosen should be saved by the delegate in ChooseDie if (this.curTileInUse) { this.curTileInUse.FireTrigger(TileAbility.PlayerTurnStateTriggers.ChooseDie, this); } } else// we were not able to select a valid die { if (this.curScarabInUse) { // return the scarab back to our list without consuming it scarabList.Add(this.curScarabInUse); PlayerBoardAllUI.RefreshScarabUI(); this.curScarabInUse = null; } } }
private static int SetPieces(string[] pieceFile, int index, PieceColor[,] colors, Quaternion[,] rotations, ref IPiece[,] pieces) { int a = 0; for (int i = index; i < pieceFile.Length; i++) { if (pieceFile[i].Trim() == "~") { return(Mathf.Clamp(i + 1, 0, pieceFile.Length - 1)); } for (int j = 0; j < pieceFile[i].Length; j++) { char c = pieceFile[i][j]; IPiece gp; switch (c) { case 'I': gp = new Pharaoh(new Point(a, j), rotations[a, j], colors[a, j], null); break; case 'S': gp = new Sphynx(new Point(a, j), rotations[a, j], colors[a, j], null); break; case 'C': gp = new Scarab(new Point(a, j), rotations[a, j], colors[a, j], null); break; case 'A': gp = new Anubis(new Point(a, j), rotations[a, j], colors[a, j], null); break; case 'P': gp = new Pyramid(new Point(a, j), rotations[a, j], colors[a, j], null); break; default: gp = new EmptyPoint(null, new Point(a, j)); break; } pieces[a, j] = gp; } a++; } return(Mathf.Clamp(index + 1, 0, pieceFile.Length - 1)); }
public Scarab AddScarab(Scarab.ScarabType scarabType) { GameState curGamestate = GameState.GetCurrentGameState(); Scarab prefab = curGamestate.scarabPrefab; GameObject prefabGO = prefab.gameObject; GameObject bugGO = GameObject.Instantiate(prefabGO); GameState.Message("Instantiate bugGO"); Scarab bug = bugGO.GetComponent<Scarab>(); bug.type = scarabType; scarabList.Add(bug); bugGO.transform.parent = this.transform; // put this under the player board hierarchy. PlayerBoardAllUI.RefreshScarabUI(); return bug; }
bool bHasExtraHerderDie = false; // true if the player has already gotten a herder die for this turn. public void NewGame() { curTileInUse = null; curScarabInUse = null; bisStartPlayer = false; bHasExtraHerderDie = false; tileList.Clear(); diceList.Clear(); for (int ii = 0; ii < 3; ++ii) { Die d6 = AddDie(DiceFactory.DieType.Red); d6.transform.parent = this.transform; } HideDice(); this.gameObject.SetActive(false); }
public Scarab AddScarab(Scarab.ScarabType scarabType) { GameState curGamestate = GameState.GetCurrentGameState(); Scarab prefab = curGamestate.scarabPrefab; GameObject prefabGO = prefab.gameObject; GameObject bugGO = GameObject.Instantiate(prefabGO); GameState.Message("Instantiate bugGO"); Scarab bug = bugGO.GetComponent <Scarab>(); bug.type = scarabType; scarabList.Add(bug); bugGO.transform.parent = this.transform; // put this under the player board hierarchy. PlayerBoardAllUI.RefreshScarabUI(); return(bug); }
public bool UseScarab(Scarab.ScarabType type) { bool bSuccess = false; Scarab hasScarab = hasScarabType(type); if (hasScarab != null) { curScarabInUse = hasScarab; scarabList.Remove(hasScarab); // remove my scarab from the list and hold it in curScarabInUse until we've decided what happens to it. Consumed or Undo. PlayerBoardAllUI.RefreshScarabUI(); // this will wait until the player has selected a die, and then perform the scarab's delegate function on that die. this.AskToChooseDie(curScarabInUse.onDieSelect, type.ToString()); } return(bSuccess); }
// does something when we acquire this tile public override void OnAcquire(PlayerBoard plr) { base.OnAcquire(plr); if (doubleCurrentTokens_Ankh) { nScarabs = plr.CountScarabs(); } for (int ii = 0; ii < nScarabs; ii++) { rndType = (Scarab.ScarabType)Random.Range(0, 2); Scarab bug = plr.AddScarab(rndType); scarabList.Add(bug); bug.name = "Scarab " + rndType.ToString(); } }
// Updates the behaviour and returns success if the agent and target is within the set range public override BehaviourResult UpdateBehaviour(Agent agent) { if (!scarabReference) { scarabReference = agent as Scarab; } if (scarabReference == null) { return(BehaviourResult.ERROR); } if (scarabReference.attacked) { return(BehaviourResult.SUCCESS); } return(BehaviourResult.FAILURE); }
public override BehaviourResult UpdateBehaviour(Agent agent) { if (m_scarab == null && (m_scarab = agent as Scarab) == null) { return(BehaviourResult.ERROR); } if (m_scarab.stopAttacking == false) { //NavMeshAgent navMesh = agent.gameObject.GetComponent<NavMeshAgent> (); //if (navMesh) // navMesh.enabled = true; // Returns the scarab layer to normal when attacking is possible m_scarab.gameObject.layer = 14; return(BehaviourResult.SUCCESS); } return(BehaviourResult.FAILURE); }
public bool UseScarab(Scarab.ScarabType type) { bool bSuccess = false; Scarab hasScarab = hasScarabType(type); if (hasScarab!=null) { curScarabInUse = hasScarab; scarabList.Remove(hasScarab); // remove my scarab from the list and hold it in curScarabInUse until we've decided what happens to it. Consumed or Undo. PlayerBoardAllUI.RefreshScarabUI(); // this will wait until the player has selected a die, and then perform the scarab's delegate function on that die. this.AskToChooseDie(curScarabInUse.onDieSelect, type.ToString()); } return bSuccess; }
/// <summary> /// Returns the power level for a scarab /// </summary> public static uint GetPower(Scarab scarab) { return(ScarabPower[scarab]); }
/// <summary> /// Returns the spell level for a scarab /// </summary> public static uint GetLevel(Scarab scarab) { return(ScarabLevel[scarab]); }
public BehaviourResult UpdateBehaviour(Agent agent) { if (!m_scarab) { m_scarab = agent as Scarab; } if (!m_player) { return(BehaviourResult.FAILURE); } if (!m_scarab && (m_scarab = agent as Scarab) == null) { Debug.Log("Agent is not a scarab"); return(BehaviourResult.ERROR); } agent.navAgent.ResetPath(); //agent.transform.LookAt(m_player.transform, agent.transform.up); Vector3 lookVector = m_player.transform.position - agent.transform.position; Quaternion lookAtTarget = Quaternion.LookRotation(lookVector, agent.transform.up); agent.transform.rotation = Quaternion.Slerp(agent.transform.rotation, lookAtTarget, agent.internalDeltaTime * m_rotationSpeed); lookVector.y = agent.transform.forward.y; float lookEvaluation = Vector3.Dot(agent.transform.forward, lookVector); if (m_scarab.attackTime <= 0 && !m_scarab.stopAttacking && lookEvaluation > 0.9f) { ////////////////////////////////////////////////////////////////////////////////////// // This is used to set up the vignette whenever the player gets attacked // Checks relative location of scarab to where the player is Vector3 relativeLocation = m_player.transform.position - m_scarab.transform.position; // Checks relative position displacement to where the player is facing // and turn on the side accordingly. This part checks forward and backward float relativeForward = Vector3.Dot(m_player.transform.forward, relativeLocation); if (relativeForward > 0.25f) { m_scarab.vignetteRef = m_player.bottomVignette; } else if (relativeForward < -0.25f) { m_scarab.vignetteRef = m_player.topVignette; } // This part checks the left and right relative position float relativeRight = Vector3.Dot(m_player.transform.right, relativeLocation); if (relativeRight > 0.25f) { m_scarab.vignetteRef = m_player.rightVignette; } else if (relativeRight < -0.25f) { m_scarab.vignetteRef = m_player.leftVignette; } /////////////////////////////////////////////////////////////////////////////////////// m_scarab.animator.SetBool("Attack Player", true); //if (agent.prevBehaviour != "Attack") //{ // m_scarab.onAttack.Invoke(); // agent.prevBehaviour = "Attack"; //} if (m_behaviourEvent != null) { m_behaviourEvent.Invoke(); } m_time = m_timer; } else if (lookEvaluation < 0.9f) { return(BehaviourResult.SUCCESS); } else { m_time -= agent.internalDeltaTime; } return(BehaviourResult.SUCCESS); }
public void NewGame() { curTileInUse = null; curScarabInUse = null; bisStartPlayer = false; bHasExtraHerderDie = false; tileList.Clear(); diceList.Clear(); for (int ii=0; ii<3; ++ii) { Die d6 = AddDie(DiceFactory.DieType.Red); d6.transform.parent = this.transform; } HideDice (); this.gameObject.SetActive (false); }
public Scarab hasScarabType(Scarab.ScarabType type) { foreach (Scarab sc in scarabList) { if (sc.type == type) { return sc; } } return null; }
public void DestroyScarab(Scarab scarab) { scarabList.Remove(scarab); Destroy (scarab.gameObject); PlayerBoardAllUI.RefreshScarabUI(); }
public int countScarabsOfType(Scarab.ScarabType type) { int nScarabs = 0; foreach (Scarab sc in scarabList) { if (sc.type == type) { nScarabs++; } } return nScarabs; }
public void DestroyScarab(Scarab scarab) { scarabList.Remove(scarab); Destroy(scarab.gameObject); PlayerBoardAllUI.RefreshScarabUI(); }
private void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { //check for each item available and add. //itemtype references the item array found under the inventoryScript //gameobject. //check if full so we can add the items if (InventoryScript.MyInstance.MyEmptySlotCount > 0) { if (itemType == "Leaflet") { Leaflet leaflet = (Leaflet)Instantiate(InventoryScript.MyInstance.items[1]); InventoryScript.MyInstance.AddItem(leaflet); } else if (itemType == "Egg") { Egg egg = (Egg)Instantiate(InventoryScript.MyInstance.items[2]); InventoryScript.MyInstance.AddItem(egg); } else if (itemType == "Sword") { Sword sword = (Sword)Instantiate(InventoryScript.MyInstance.items[3]); InventoryScript.MyInstance.AddItem(sword); } else if (itemType == "Trident") { Trident trident = (Trident)Instantiate(InventoryScript.MyInstance.items[4]); InventoryScript.MyInstance.AddItem(trident); } else if (itemType == "Airpump") { AirPump ap = (AirPump)Instantiate(InventoryScript.MyInstance.items[5]); InventoryScript.MyInstance.AddItem(ap); } else if (itemType == "Bar") { PlatinumBar bar = (PlatinumBar)Instantiate(InventoryScript.MyInstance.items[6]); InventoryScript.MyInstance.AddItem(bar); } else if (itemType == "Knife") { Knife knife = (Knife)Instantiate(InventoryScript.MyInstance.items[7]); InventoryScript.MyInstance.AddItem(knife); } else if (itemType == "Rope") { Rope rope = (Rope)Instantiate(InventoryScript.MyInstance.items[8]); InventoryScript.MyInstance.AddItem(rope); } else if (itemType == "Skull") { Skull skull = (Skull)Instantiate(InventoryScript.MyInstance.items[9]); InventoryScript.MyInstance.AddItem(skull); } else if (itemType == "Sack") { Sack sack = (Sack)Instantiate(InventoryScript.MyInstance.items[10]); InventoryScript.MyInstance.AddItem(sack); } else if (itemType == "Lantern") { Lantern lantern = (Lantern)Instantiate(InventoryScript.MyInstance.items[11]); InventoryScript.MyInstance.AddItem(lantern); } else if (itemType == "Bottle") { Bottle bottle = (Bottle)Instantiate(InventoryScript.MyInstance.items[12]); InventoryScript.MyInstance.AddItem(bottle); } else if (itemType == "Candle") { Candle candle = (Candle)Instantiate(InventoryScript.MyInstance.items[13]); InventoryScript.MyInstance.AddItem(candle); } else if (itemType == "BlackBook") { BlkBook book = (BlkBook)Instantiate(InventoryScript.MyInstance.items[14]); InventoryScript.MyInstance.AddItem(book); } else if (itemType == "PlasticPile") { PlasticPile plastic = (PlasticPile)Instantiate(InventoryScript.MyInstance.items[15]); InventoryScript.MyInstance.AddItem(plastic); } else if (itemType == "Buoy") { Buoy buoy = (Buoy)Instantiate(InventoryScript.MyInstance.items[16]); InventoryScript.MyInstance.AddItem(buoy); } else if (itemType == "Shovel") { Shovel shovel = (Shovel)Instantiate(InventoryScript.MyInstance.items[17]); InventoryScript.MyInstance.AddItem(shovel); } else if (itemType == "Scarab") { Scarab scarab = (Scarab)Instantiate(InventoryScript.MyInstance.items[18]); InventoryScript.MyInstance.AddItem(scarab); } else if (itemType == "PotOfGold") { PotOfGold gold = (PotOfGold)Instantiate(InventoryScript.MyInstance.items[19]); InventoryScript.MyInstance.AddItem(gold); } else if (itemType == "Bracelet") { Bracelet bracelet = (Bracelet)Instantiate(InventoryScript.MyInstance.items[20]); InventoryScript.MyInstance.AddItem(bracelet); } else if (itemType == "Coal") { Coal coal = (Coal)Instantiate(InventoryScript.MyInstance.items[21]); InventoryScript.MyInstance.AddItem(coal); } else if (itemType == "Figurine") { Figurine fig = (Figurine)Instantiate(InventoryScript.MyInstance.items[22]); InventoryScript.MyInstance.AddItem(fig); } else if (itemType == "Diamond") { Diamond diamond = (Diamond)Instantiate(InventoryScript.MyInstance.items[23]); InventoryScript.MyInstance.AddItem(diamond); } else if (itemType == "Torch") { Torch torch = (Torch)Instantiate(InventoryScript.MyInstance.items[24]); InventoryScript.MyInstance.AddItem(torch); } else if (itemType == "Coins") { Coins coins = (Coins)Instantiate(InventoryScript.MyInstance.items[25]); InventoryScript.MyInstance.AddItem(coins); } else if (itemType == "Key") { Key key = (Key)Instantiate(InventoryScript.MyInstance.items[26]); InventoryScript.MyInstance.AddItem(key); } else if (itemType == "Matches") { Matches matches = (Matches)Instantiate(InventoryScript.MyInstance.items[27]); InventoryScript.MyInstance.AddItem(matches); } else if (itemType == "Wrench") { Wrench wrench = (Wrench)Instantiate(InventoryScript.MyInstance.items[28]); InventoryScript.MyInstance.AddItem(wrench); } else if (itemType == "Screwdriver") { Screwdriver sd = (Screwdriver)Instantiate(InventoryScript.MyInstance.items[29]); InventoryScript.MyInstance.AddItem(sd); } else if (itemType == "Jewels") { Jewels jewels = (Jewels)Instantiate(InventoryScript.MyInstance.items[30]); InventoryScript.MyInstance.AddItem(jewels); } else if (itemType == "Coffin") { Coffin coffin = (Coffin)Instantiate(InventoryScript.MyInstance.items[31]); InventoryScript.MyInstance.AddItem(coffin); } else if (itemType == "Chalice") { Chalice chalice = (Chalice)Instantiate(InventoryScript.MyInstance.items[32]); InventoryScript.MyInstance.AddItem(chalice); } //the following items should not be displayed in the world //but going to add just in case we revamp how these items //are obtained. else if(itemType == "Garlic") { Garlic garlic = (Garlic)Instantiate(InventoryScript.MyInstance.items[33]); InventoryScript.MyInstance.AddItem(garlic); } else if(itemType == "Sceptre") { Sceptre sep = (Sceptre)Instantiate(InventoryScript.MyInstance.items[34]); InventoryScript.MyInstance.AddItem(sep); } Destroy(gameObject); } //probably want to utilize CLI popup here else { Debug.Log("Bag full"); } } }