internal BaseGovernment(byte id, string name, string nameAdjective, IAdvance requiredTech = null) { Id = id; Name = name; NameAdjective = nameAdjective; RequiredTech = requiredTech; }
private void StealTechnology(object sender, EventArgs args) { IAdvance advance = _diplomat.GetAdvanceToSteal(_enemyCity.Player); if (advance == null) { GameTask.Insert(Message.General($"No new technology found")); } else { GameTask task = new Tasks.GetAdvance(_diplomat.Player, advance); task.Done += (s1, a1) => { Game.DisbandUnit(_diplomat); if (_diplomat.Player == Human || _enemyCity.Player == Human) { GameTask.Insert(Message.Spy("Spies report:", $"{_diplomat.Player.TribeName} steal", $"{advance.Name}")); } }; GameTask.Enqueue(task); } Cancel(); }
void Awake() { currentState = null; walk = new WalkAdvance(rb, characterSpeed); run = new RunAdvance(rb, characterRunSpeed); jump = new JumpAdvance(rb, characterJumpStr); }
public bool GetAdvanceOrigin(IAdvance advance, Player player) { if (_advanceOrigin.ContainsKey(advance.Id)) { return(_advanceOrigin[advance.Id] == PlayerNumber(player)); } return(false); }
public RoverSpaceVehicle( ITurnLeft turnLeftAlgorithm , ITurnRight turnRightAlgorithm , IAdvance advanceAlgorithm , MarsOrientations roverOrientation) { _turnLeftBehavior = turnLeftAlgorithm; _turnRightBehavior = turnRightAlgorithm; _advanceBehavior = advanceAlgorithm; _roverPositionInMars = new Position(); //Default 0 , 0 Coordination; _roverOrientationsInMars = roverOrientation; }
BoxCollider2D _collider; //Agus void Awake() { _collider = GetComponent <BoxCollider2D>();//Agus spawnBullet = GetComponent <SoldierSpawnerPool>(); currentHP = _maxHP; timer = fireRate; startPos = transform.position; myController = new BSControl(this, GetComponentInChildren <BSView>()); myCurrentNormal = new NormalSoldierAdvance(transform, startPos); myCurrentBack = new BackSoldierAdvance(transform, startPos); myCurrentFollow = new FollowSoldierAdvance(transform, target); myCurrentShoot = new BSShootAdvance(this, fireRate, timer); }
PolygonCollider2D _polygon; //Agus void Awake() { _polygon = GetComponent <PolygonCollider2D>();//Agus spawnBullet = GetComponent <EnemySpawnBullet>(); currentHP = _maxHP; timer = fireRate; outputGunL = GameObject.Find("OutputL").GetComponent <Transform>(); outputGunR = GameObject.Find("OutputR").GetComponent <Transform>(); myController = new ControlEnemy(this, GetComponentInChildren <ViewEnemy>()); myCurrentNormal = new NormalAdvance(transform); myCurrentFollow = new FollowAdvance(transform, target); myCurrentShoot = new ShootAdvance(this, fireRate, timer); }
public void AddAdvance(IAdvance advance, bool setOrigin = true) { if (Game.Started && Game.CurrentPlayer.CurrentResearch?.Id == advance.Id) { GameTask.Enqueue(new TechSelect(Game.CurrentPlayer)); } _advances.Add(advance.Id); if (!setOrigin) { return; } Game.Instance.SetAdvanceOrigin(advance, this); }
public void SetAdvanceOrigin(IAdvance advance, Player player) { if (_advanceOrigin.ContainsKey(advance.Id)) { return; } byte playerNumber = 0; if (player != null) { playerNumber = PlayerNumber(player); } _advanceOrigin.Add(advance.Id, playerNumber); }
private void PlayerAdvances_Accept(object sender, EventArgs args) { IAdvance advance = _advances[_advanceSelect.ActiveItem + _index]; _selected = _advanceSelect.ActiveItem; if (_selectedPlayer.HasAdvance(advance)) { _selectedPlayer.DeleteAdvance(advance); } else { _selectedPlayer.AddAdvance(advance); } CloseMenus(); }
public void Shoot(IAdvance tipoDisparo) { Bullet b = BulletSpawner.Instance.pool.GetObject().SetSpeed(bulletSpeed).SetTimeToDie(shootCooldown).SetOwner(this); b.transform.position = pointToSpawn.position; b.transform.rotation = transform.rotation; advance = tipoDisparo; advance.SetTransform = b.transform; advance.SetSpeed = b.Speed; b.SetType(advance); b.Subscribe(this); _shootCDCor = StartCoroutine(ShootCooldown()); //Corrutina del cooldown para volver a disparar }
void Update() { if (Input.GetButtonDown("Jump") && isJumping == false) { currentState = jump; isJumping = true; isWalking = false; ground = 1; } else if (Input.GetAxis("Vertical") != 0 && Input.GetKey(KeyCode.LeftShift) || Input.GetAxis("Horizontal") != 0 && Input.GetKey(KeyCode.LeftShift)) { isWalking = true; currentState = run; } else if (Input.GetAxis("Vertical") != 0 || Input.GetAxis("Horizontal") != 0) { isWalking = true; currentState = walk; } else { isWalking = false; currentState = null; } if (currentState != null) { currentState.Advance(); } if (isGrounded) { Grounding(); } else { isWalking = true; } }
private void ApplyBonus(byte player) { byte bonus = (byte)(_players.Max(p => p.Handicap) - _players[player].Handicap); IUnit startUnit = _units.Where(u => u.Owner == player).FirstOrDefault(); if (startUnit == null) { return; } int x = startUnit.X, y = startUnit.Y; if (bonus >= 4) { // If the Bonus value of the civ is 4 or higher, then the civ is granted an extra Settlers unit, for a total of two Settlers units. // In this case, the Bonus value is reduced by 3 afterwards. IUnit unit = CreateUnit(UnitType.Settlers, x, y); unit.Owner = player; _units.Add(unit); bonus -= 3; } // If the Bonus value is (still) greater than zero, then the civ gains a number of technologies equal to the Bonus value. while (bonus > 0) { IAdvance[] available = _players[player].AvailableResearch.ToArray(); int advanceId = Common.Random.Next(0, 72); for (int i = 0; i < 1000; i++) { if (!available.Any(a => a.Id == (advanceId + i) % 72)) { continue; } IAdvance advance = available.First(a => a.Id == (advanceId + i) % 72); SetAdvanceOrigin(advance, null); _players[player].AddAdvance(advance, false); break; } bonus--; } }
public Discovery(IAdvance advance) { _advance = advance; _modern = Human.HasAdvance <Electricity>() && advance.Not <Electricity>(); string scientistName = Human.HasAdvance <Invention>() && (advance.Not <Invention>()) ? "scientists" : "wise men"; Picture background = Resources[$"DISCOVR{(_modern ? 2 : 1)}"]; Palette = background.Palette; this.Clear(32) .AddLayer(background); string[] text = new string[] { $"{Human.TribeName} {scientistName}", "discover the secret", $"of {advance.Name}!" }; for (int i = 0; i < text.Length; i++) { if (_modern) { this.DrawText(text[i], 0, 3, 101, 30 + (8 * i)); } else { this.DrawText(text[i], 5, 32, 101, 7 + (15 * i)) .DrawText(text[i], 5, 15, 101, 6 + (15 * i)); } } this.AddLayer(advance.Icon, 119, _modern ? 53 : 61); PlaySound(Human.Civilization.Tune); }
public Discovery(IAdvance advance) { _advance = advance; _modern = Human.HasAdvance <Electricity>() && advance.Not <Electricity>(); string scientistName = Human.HasAdvance <Invention>() && (advance.Not <Invention>()) ? "scientists" : "wise men"; Picture background = Resources.Instance.LoadPIC(_modern ? "DISCOVR2" : "DISCOVR1"); _canvas = new Picture(320, 200, background.Palette); _canvas.FillRectangle(32, 0, 0, 320, 200); AddLayer(background); string[] text = new string[] { $"{Human.TribeName} {scientistName}", "discover the secret", $"of {advance.Name}!" }; for (int i = 0; i < text.Length; i++) { if (_modern) { _canvas.DrawText(text[i], 0, 3, 101, 30 + (8 * i)); } else { _canvas.DrawText(text[i], 5, 32, 101, 7 + (15 * i)); _canvas.DrawText(text[i], 5, 15, 101, 6 + (15 * i)); } } AddLayer(advance.Icon, 119, _modern ? 53 : 61); }
private void Steal(IAdvance advance) { GameTask.Enqueue(new Tasks.GetAdvance(_player, advance)); Cancel(); }
public RoverInMars() { _turnLeftAlgorithm = new TurnLeftInMars(); _turnRightAlgorithm = new TurnRightInMars(); _advanceAlgorithm = new AdvanceInMars(); }
public GetAdvance(Player player, IAdvance advance) { _advance = advance; _player = player; _human = (Human == player); }
public bool HasAdvance(IAdvance advance) => (advance == null || Advances.Any(a => a.Id == advance.Id));
public void DeleteAdvance(IAdvance advance) { _advances.RemoveAll(x => x == advance.Id); }
public Bullet SetType(IAdvance advance) { _movementType = advance; return(this); }