private void Button_Click(object sender, RoutedEventArgs e) { bandit = new Robber(); AttackBTN.IsEnabled = true; TextLog.Text += $"{bandit.Name} появился!\n"; MessageBox.Show(player.Experience.ToString()); }
public void Rpc_MoveRobbersTo(int hexId) { if (playerPhase == PlayerPhase.MoveRobber) { Robber.MoveTo(mapManager.hexes[hexId]); } }
public MainWindow() { InitializeComponent(); player = new Player { Name = "tester", Health = 100, Protection = 0, CarriedWeight = 50, ExpThresold = 1000, Level = 1, Experience = 0 }; bandit = new Robber(); player.Equip(new Colt(), true); player.Equip(new Marauder(), false); for (int i = 0; i < player.Inventory.Chunks.Count; i++) { for (int di = 0; di < player.Inventory.Chunks[i].Items.Count; di++) { InventoryGrid.Items.Add(player.Inventory.Chunks[i].Items[di]); } } }
void ApplyAbilities(Robber robber) { foreach (var ability in _spawnAbilities) { robber.AddAbility(ability); } }
private void Button_Click_1(object sender, RoutedEventArgs e) { //In method if (!bandit.Dead && !player.Dead) { bandit.ReceiveDamage(player.Damage); player.ReceiveDamage(bandit.Damage); TextLog.Text += $"{player.Name} нанес: {player.Damage} \n{bandit.Fraction}:{bandit.Name} остался с {bandit.Health}HP \n" + $"{player.Name} остается с: {player.Health}HP\n"; } if (player.Dead) { TextLog.Text += $"{player.Name} умирает\n"; AttackBTN.IsEnabled = false; } if (bandit.Dead) { TextLog.Text += $"{bandit.Name} умирает\n"; player.ReceiveExperience(bandit, player); bandit = null; AttackBTN.IsEnabled = false; } }
public void RandomMap(int seed) { Random.InitState(seed); foreach (Hex hex in hexes) { if (!hex.desert) { int tempR = Random.Range(0, resList.Count); int tempN = Random.Range(0, numList.Count); hex.SetupHex(resList[tempR], numList[tempN]); resList.RemoveAt(tempR); numList.RemoveAt(tempN); } else { hex.SetDesert(); Robber.SetAt(hex); } } foreach (Port p in ports) { //Debug.Log(portList.Count); int t = Random.Range(0, portList.Count); //Debug.Log(portList.Count + " " + portList[t]); p.SetupPort(portList[t]); portList.RemoveAt(t); } }
//method to access singleton public static Robber accessRobber() { if (robber == null) { robber = new Robber(); } return(robber); }
void Start() { text = GameObject.FindGameObjectWithTag("text"); m = GameObject.FindGameObjectWithTag("mesh").GetComponent <SkinnedMeshRenderer>(); textObj = text.GetComponent <TextMesh>(); text.SetActive(false); robber = GetComponent <Robber>(); }
private void Init() { if (_robber == null) { _robber = GetComponent <Robber>(); _robber.FollowOnEvent(); _robber.DropState = new RobberPrisonDropState(); _robber.GetComponent <FillingRobber>().RobbersSound.PlayTimerAudio(false); } }
void Start() { savedTime = Time.time; breaking = false; rb = GetComponent <Rigidbody>(); rb.velocity = new Vector3(0, 0, speedDownLimit / 3.6f); lastPosition = transform.position; health = maxHealth; healthBar.setMaxHealth(maxHealth); distanceTravelled = 0; robber = GameObject.Find("Robber").GetComponent <Robber>(); }
// Lowest HP targeting system. // Switch to whichever potential target has the lowest current HP. int SortByLowestHP(Robber a, Robber b) { if (a.CurrentHealth < b.CurrentHealth) { return(-1); } else if (a.CurrentHealth > b.CurrentHealth) { return(1); } return(0); }
public void placeRobberOnTile(int tileID) { GameTile tile = GameTiles [tileID]; GameObject robberGO = Instantiate(robberPrefab, tile.transform); robberGO.transform.position = tile.transform.position; robber = robberGO.GetComponent <Robber> (); robber.isActive = true; robber.occupyingTile = tile; tile.occupier = robber; }
// Closest targeting system. // Attack whatever target is the closest. int SortByDistance(Robber a, Robber b) { var aDistance = Vector3.Distance(transform.position, a.transform.position); var bDistance = Vector3.Distance(transform.position, b.transform.position); if (aDistance < bDistance) { return(-1); } else if (aDistance > bDistance) { return(1); } return(0); }
IEnumerator SpawnGroup() { var remainingSpawnPoints = _difficulty.DetermineSpawnDifficulty(); while (remainingSpawnPoints > 0) { Robber robber = _factory.BuildRandomRobber(remainingSpawnPoints); if (robber == null) { break; } remainingSpawnPoints -= robber.SpawnCost; _spawner.AddToQueue(new SpawnData(robber, DeterminePath())); yield return(null); } }
void ApplyAbilities(GrandHeist heist, Robber robber) { foreach (var ability in heist.Abilities) { robber.AddAbility(ability); } if (heist.RandomAbilitiesToAddToEachRobber.Max > 0) { var abilities = RefManager.AbilityFactory.GetRobberAbilities( robber.AbilityPrerequisites, heist.RandomAbilitiesToAddToEachRobber.RandomInt); foreach (var ability in abilities) { robber.AddAbility(ability); } } }
public void SpawnNext() { if (_currentHeistIndex == _heists.Length - 1) { print("Final wave. Pause all income, prevent build mode etc???"); } GrandHeist heist = _heists[_currentHeistIndex]; var spawnCurrency = heist.AdditionalSpawnCurrency; List <Robber> robbersToSpawn = new List <Robber>(); foreach (var rd in heist.RobbersInHeist) { var robber = _factory.BuildRobber(rd); ApplyAbilities(heist, robber); robbersToSpawn.Add(robber); } while (spawnCurrency > 0) { Robber robber = _factory.BuildRandomRobber(spawnCurrency); if (robber == null) { break; } spawnCurrency -= robber.SpawnCost; ApplyAbilities(heist, robber); robbersToSpawn.Add(robber); } // Trigger heist animation // On heist animation end _spawnController.SpawnGroup(robbersToSpawn); _currentHeistIndex++; }
// Use this for initialization void Start() { charController = this.GetComponent <Rigidbody>(); player = GameObject.Find("Robber"); currentState = CopState.patrolling; curPatrolPoint = 0; forwards = true; //initalize timers alertTimer = maxAlertTime; recognitionTimer = maxRecognitionTime; flashLight.range = alertSightRadius; flashLight.spotAngle = sightAngle + 3; robber = GameObject.FindGameObjectWithTag("Player").GetComponent <Robber>(); trash = GameObject.FindGameObjectsWithTag("disguise"); if (trash.Length <= 0) { for (int i = 0; i < trash.Length; i++) { disguise[i] = trash[i].GetComponent <useDisguise>(); } } }
// Use this for initialization void Start() { robbie = GameObject.FindGameObjectWithTag("Player"); rob = robbie.GetComponent <Robber>(); }
public override TimedMethod[] EnemyTurn() { Robber robber = (Robber)Party.GetEnemy(1); return(robber.Ambush()); }
public SpawnData(Robber robber, Path path) { Robber = robber; Path = path; }
IEnumerator spendFishTokenResults() { int numTokensNeeded = 0; bool success = false; AssetTuple assetsToRemove = new AssetTuple(); switch (rewardSelection) { case 0: //move robber numTokensNeeded = 2; Robber robber = GameObject.FindObjectOfType <Robber> (); Pirate pirate = GameObject.FindObjectOfType <Pirate> (); if (robber != null && pirate != null) { CatanManager.instance.uiManager.robberPiratePanel.gameObject.SetActive(true); bool selected = false; while (!selected) { if (!CatanManager.instance.uiManager.robberPiratePanel.selectionMade) { yield return(StartCoroutine(CatanManager.instance.uiManager.robberPiratePanel.waitUntilButtonDown())); } if (CatanManager.instance.uiManager.robberPiratePanel.selectionMade) { selected = true; } } CatanManager.instance.uiManager.robberPiratePanel.gameObject.SetActive(false); CatanManager.instance.uiManager.robberPiratePanel.selectionMade = false; StartCoroutine(CatanManager.instance.moveGamePieceForCurrentPlayer(CatanManager.instance.uiManager.robberPiratePanel.selection, true, false)); } else if (robber != null) { StartCoroutine(CatanManager.instance.moveGamePieceForCurrentPlayer(0, true, false)); } else if (pirate != null) { StartCoroutine(CatanManager.instance.moveGamePieceForCurrentPlayer(1, true, false)); } for (int i = 0; i < FishTokens.Length; i++) { Debug.Log("Set index " + (i + 8) + " of assetToRemove to = " + (int)FishTokens [i].value); assetsToRemove.SetValueAtIndex(i + 8, (int)FishTokens [i].value); } success = true; break; case 1: //steal random resource numTokensNeeded = 3; List <Player> stealableOpponents = new List <Player> (); for (int i = 0; i < PhotonNetwork.playerList.Length; i++) { stealableOpponents.Add(CatanManager.instance.players[i]); } stealableOpponents.Remove(CatanManager.instance.players [CatanManager.instance.currentPlayerTurn]); if (stealableOpponents.Count != 0) { yield return(StartCoroutine(CatanManager.instance.stealRandomResource(stealableOpponents))); this.gameObject.SetActive(false); for (int i = 0; i < FishTokens.Length; i++) { Debug.Log("Set index " + (i + 8) + " of assetToRemove to = " + (int)FishTokens [i].value); assetsToRemove.SetValueAtIndex(i + 8, (int)FishTokens [i].value); } success = true; } break; case 2: //take resource of choice numTokensNeeded = 4; CatanManager.instance.uiManager.fishResourceSelection(); bool selectionMade = false; this.transform.localScale = Vector3.zero; CatanManager.instance.uiManager.fishresourcepanel.gameObject.SetActive(true); while (!selectionMade) { if (!CatanManager.instance.uiManager.fishresourcepanel.selectionMade) { yield return(StartCoroutine(CatanManager.instance.uiManager.fishresourcepanel.waitUntilButtonDown())); } if (CatanManager.instance.uiManager.fishresourcepanel.selectionMade) { selectionMade = true; } } CatanManager.instance.uiManager.fishresourcepanel.gameObject.SetActive(false); CatanManager.instance.uiManager.fishresourcepanel.selectionMade = false; this.transform.localScale = scale; this.gameObject.SetActive(false); AssetTuple assetsToGain = GameAsset.getAssetOfIndex(CatanManager.instance.uiManager.fishresourcepanel.getSelection(), 1); EventTransferManager.instance.OnTradeWithBank(CatanManager.instance.currentPlayerTurn, true, assetsToGain); for (int i = 0; i < FishTokens.Length; i++) { Debug.Log("Set index " + (i + 8) + " of assetToRemove to = " + (int)FishTokens [i].value); assetsToRemove.SetValueAtIndex(i + 8, (int)FishTokens [i].value); } success = true; break; case 3: //build road numTokensNeeded = 5; int numRoadsInitial = CatanManager.instance.players [CatanManager.instance.currentPlayerTurn].getOwnedUnitsOfType(UnitType.Road).Count; this.transform.localScale = Vector3.zero; yield return(StartCoroutine(CatanManager.instance.unitManager.buildRoad(false))); int numRoadsFinal = CatanManager.instance.players [CatanManager.instance.currentPlayerTurn].getOwnedUnitsOfType(UnitType.Road).Count; this.transform.localScale = scale; this.gameObject.SetActive(false); if (numRoadsInitial + 1 != numRoadsFinal) { this.gameObject.SetActive(true); } else { for (int i = 0; i < FishTokens.Length; i++) { Debug.Log("Set index " + (i + 8) + " of assetToRemove to = " + (int)FishTokens [i].value); assetsToRemove.SetValueAtIndex(i + 8, (int)FishTokens [i].value); } success = true; } break; case 4: numTokensNeeded = 7; CatanManager.instance.uiManager.cardSelectPanel.gameObject.SetActive(true); for (int i = 0; i < FishTokens.Length; i++) { Debug.Log("Set index " + (i + 8) + " of assetToRemove to = " + (int)FishTokens [i].value); assetsToRemove.SetValueAtIndex(i + 8, (int)FishTokens [i].value); } success = true; break; } if (assetsToRemove.fishTokens.numTotalTokens() == 0) { success = false; } if (success) { int numTokens = assetsToRemove.fishTokens.numTotalTokens(); int indexRemoved = 0; while (numTokens >= numTokensNeeded) { int nextLargestIndex = assetsToRemove.fishTokens.nextAvailableLargestIndex(); if (assetsToRemove.fishTokens.fishTuple.ContainsKey((FishTokenType)nextLargestIndex)) { assetsToRemove.fishTokens.fishTuple [(FishTokenType)nextLargestIndex]--; indexRemoved = nextLargestIndex; } else { break; } numTokens = assetsToRemove.fishTokens.numTotalTokens(); } assetsToRemove.fishTokens.fishTuple [(FishTokenType)indexRemoved]++; //CatanManager.instance.players [CatanManager.instance.currentPlayerTurn].spendAssets (assetsToRemove); EventTransferManager.instance.OnTradeWithBank(CatanManager.instance.currentPlayerTurn, false, assetsToRemove); rewardSelection = -1; selectionGlow.gameObject.SetActive(false); this.gameObject.SetActive(false); StopAllCoroutines(); EventTransferManager.instance.OnOperationFailure(); } }
// Use this for initialization void Awake() { singleton = this; }