/// <summary> /// /// </summary> /// <param name="textureDictionary">all the different textures the ship uses, most used are Default, Left and Right</param> /// <param name="position">position of the ship</param> /// <param name="turrets">turrets on the ship</param> /// <param name="healthMax">max health</param> /// <param name="energyMax">max energy</param> /// <param name="energyRegen">energy regen per frame</param> /// <param name="turnRate">how fast the ship turns</param> public Ship(IReadOnlyDictionary <string, Texture2D> textureDictionary, Vector2 position, Dictionary <string, List <ITurret> > turrets, float healthMax, float energyMax, float energyRegen, float turnRate, float speed, TractorBeam tractorBeam, int upgradeCount) : base(textureDictionary["Default"], position) { foreach (var t in turrets) { Turrets.Add(t.Key, t.Value); } foreach (var entry in textureDictionary) { TextureDictionary.Add(entry.Key, entry.Value); } Upgrades = new Upgrade[upgradeCount]; TractorBeam = tractorBeam; HealthMax = healthMax; BaseHealth = healthMax; Health = healthMax; BaseEnergy = energyMax; EnergyMax = energyMax; Energy = energyMax; BaseEnergyRegen = energyRegen; EnergyRegen = energyRegen; TurnRate = turnRate; Speed = speed; BackwardsSpeed = 1 / 5f * speed; StrafeSpeed = 3 / 5f * speed; }
protected Base() { ObjConstants = new Constants(); ObjHeroes = new Heroes(); ObjMinions = new Minions(); ObjTurrets = new Turrets(); Menu = new Menu("AIM", "AIM", true); //AIM Settings Menu.AddItem(new MenuItem("Enabled", "Enabled").SetValue(new KeyBind(32, KeyBindType.Toggle))); Menu.AddItem(new MenuItem("LowHealth", "Self Low Health %").SetValue(new Slider(20, 10, 50))); //Humanizer var move = Menu.AddSubMenu(new Menu("Humanizer", "humanizer")); move.AddItem(new MenuItem("MovementEnabled", "Enabled").SetValue(true)); move.AddItem(new MenuItem("MovementDelay", "Movement Delay")).SetValue(new Slider(400, 0, 1000)); Menu.AddToMainMenu(); Console.WriteLine("Menu Init Success!"); ObjHQ = new HQ(); Orbwalker = Menu.AddSubMenu(new Menu("Orbwalker", "Orbwalker")); OrbW = new Orbwalking.Orbwalker(Orbwalker); Obj_AI_Base.OnIssueOrder += Obj_AI_Base_OnIssueOrder; }
private void LevelUp() { if (Stats.Xp >= Stats.MaxXP) { Stats.Level++; Stats.Xp = 0; if (Stats.MaxHealth < 5) { Stats.MaxHealth++; } Stats.Health = Stats.MaxHealth; Stats.MaxHealth += 50; if ((int)_turretCount < 2) { _turretCount++; } else { _turretCount = 0; } if (_levelUpSound != null) { AudioHandler.PlaySFX(_levelUpSound); } } }
public void AddCannonTurret(CannonTurret turret) { if (!Turrets.Contains(turret)) { Turrets.Add(turret); } }
protected Base() { ObjConstants = new Constants(); ObjHeroes = new Heroes(); ObjMinions = new Minions(); ObjTurrets = new Turrets(); OrbW = new Orbwalker(); }
// Start is called before the first frame update void Start() { stats = gameObject.GetComponent <Turrets>(); gm = GameObject.Find("GameMaster").GetComponent <GameMaster>(); System.Random rand = new System.Random(); int variable = rand.Next(0, 9999); rayTrigger.name = "" + variable; }
public void OnTick() { if (!OnGoing) { return; } CheckParticipation(); UpdateAllGumps(); if (StartTime + TimeSpan.FromMinutes(Duration) < DateTime.UtcNow) { EndBattle(); return; } if (LastOccupationCheck + TimeSpan.FromMinutes(1) < DateTime.UtcNow) { CheckOccupation(); LastOccupationCheck = DateTime.UtcNow; } if (NextAltarActivate != DateTime.MinValue && NextAltarActivate < DateTime.UtcNow) { ActivateAltar(); NextAltarActivate = DateTime.MinValue; } if (NextSigilSpawn != DateTime.MinValue && NextSigilSpawn < DateTime.UtcNow) { if (Sigil == null || Sigil.Deleted) { SpawnSigil(); } } ActivateArrows(); if (KillCooldown != null) { List <Mobile> list = KillCooldown.Keys.Where(mob => KillCooldown[mob] < DateTime.UtcNow).ToList(); foreach (Mobile m in list) { KillCooldown.Remove(m); } ColUtility.Free(list); } if (Turrets != null) { Turrets.ForEach(t => { t.Scan(); }); } }
public void CreateTurret(Vector2 location, int owner) { Turret t = new Turret(location, owner); Turrets.Add(t); if (AddTurret != null) { AddTurret(this, new TurretArgs(t)); } }
private void BuildTurret(Vector3 position) { if (childTurret == null) { if (position == transform.position) { childTurret = Instantiate(BuildManager.instance.TurretToBuild, transform); DeselectNode(); } } }
public void FirstUpdate(GameTime gameTime) { Music.Beat += new EventHandler(OnBeat); Music.Start(gameTime.TotalRealTime); spawner = new Spawner(); for (int i = 0; i < 4; i++) { Players[i].IsActive = true; Turrets.Add(new Turret(new Vector2((i % 2 + 1) * 250, (float)Math.Ceiling((double)i / 2) * 250), i)); } }
public void DeleteTurret(Turret t) { if (Turrets.Contains(t)) { // TODO: Investigate this memory leak. t.Active = false; Turrets.Remove(t); if (RemoveTurret != null) { RemoveTurret(this, new TurretArgs(t)); } } }
public override void CreateStructure( float xPos, float yPos, StructureTypes structureType, float health, float constructionPoints, int ID, HashSet <int> teams) { Structure structure; switch (structureType) { case (StructureTypes.LaserTurret): /*Turret t = new PlanetTurret(_projectileManager, _textureManager, _shipManager, new Vector2(xPos, yPos), buildingType, _bus, _physicsManager, health, ID, 666); * structures.Add(ID, t); * t.potentialTargets = _potentialTargets; * t.isLocalSim = localSim; */ Turret t = new Turret(_projectileManager, _textureManager, _shipManager, _bus, _physicsManager.World, new Vector2(xPos, yPos), structureType, health, ID, 666, TurretTypes.Planet, teams); _teamManager.RegisterObject(t); _structures.Add(t); Turrets.Add(t); t.IsAlliedWithPlanetOwner = true; //True by default, may change later structure = t; break; case (StructureTypes.CommandCenter): { structure = new CommandCenter(_bus, _messageManager.SendEnterColonyRequest, _shipManager.IsEnterModeOn, _physicsManager.World, _textureManager, new Vector2(xPos, yPos), structureType, health, ID, teams); _teamManager.RegisterObject(structure); _structures.Add(structure); break; } default: structure = new Structure(_bus, _textureManager, xPos, yPos, structureType, health, ID, teams); // Need to move this _structures.Add(structure); structure.Body = BodyFactory.CreateCircle(_physicsManager.World, 1, 1, new StructureBodyDataObject(BodyTypes.Structure, ID, structure)); break; } _targetManager.RegisterObject(structure); }
public void Init() { _canMove = true; _rigidbody2D = GetComponent <Rigidbody2D>(); _rigidbody2D.gravityScale = 0; _rigidbody2D.angularDrag = 999; _rigidbody2D.constraints = RigidbodyConstraints2D.FreezeRotation; Stats.Health = Stats.MaxHealth; Stats.Level = 1; _spriteBlinkingMiniDuration = .1f; _spriteBlinkingTotalDuration = 1.2f; _spriteBlinkingTimer = 0f; _spriteBlinkingTotalTimer = 0f; _turretCount = Turrets.Single; }
public static void Load() { Gapcloser.OnGapcloser += Gapcloser_OnGapCloser; Interrupter.OnInterruptableSpell += Interrupter_OnInterruptableSpell; Orbwalker.OnPostAttack += Orbwalker_OnPostAttack; Obj_AI_Base.OnBasicAttack += Obj_Ai_Base_OnBasicAttack; Obj_AI_Base.OnProcessSpellCast += Obj_AI_Base_OnProcessSpell; Obj_AI_Base.OnBuffGain += Obj_AI_Base_OnBuffGain; Obj_AI_Base.OnSpellCast += Obj_AI_Base_OnSpellCast; GameObject.OnCreate += GameObject_OnCreate; Game.OnTick += Game_OnTick; Game.OnUpdate += Game_OnUpdate; Player.OnIssueOrder += Player_OnIssueOrder; Drawing.OnDraw += OnDraw; Mechanics.LoadFlash(); Traps.Load(); Turrets.Load(); Evade.EvadeHelper.OnLoad(); }
private void AttackTurret() { // Find closest enemy if (targetedTransform == null) { targetedTransform = FindClosestTower(); } if (targetedTransform == null) { GoToEnd(); return; } // Pathfind towards turret if (agent.destination != targetedTransform.transform.position) { agent.SetDestination(targetedTransform.transform.position); } // Attack closest turret. if (Vector3.Distance(transform.position, targetedTransform.position) < attackRange) { Debug.Log("I am attempting to attack " + targetedTransform.name); if (canAttack) { Debug.Log("I have attacked " + targetedTransform.name, targetedTransform); // Deal Damage // Damage should be dealt through animation event. Debug.Log("I dealt damage."); //Destroy(targetedTransform.gameObject); Turrets turret = FindObjectsOfType <Turrets>().Where(t => t.transform.position == targetedTransform.position).FirstOrDefault(); DealDamage(turret); ResetAttack(); GoToEnd(); } } }
internal static void Initialize() { // Initialize all cached classes Heroes.Initialize(); Turrets.Initialize(); }
private void ChooseTurrets(Turrets turrets) { switch (turrets) { case Turrets.Single: Stats.FireRate = .2f; GameObject bullet = ObjectPooler.Instance.GetPlayerProjectileObject(); if (bullet != null) { //Getting the child 0 - Turret 0 - from the transform and spawning a bullet from the pool bullet.transform.position = gameObject.transform.GetChild(0).position; bullet.transform.rotation = gameObject.transform.GetChild(0).rotation; bullet.GetComponent <Projectile>().MoveDirection = gameObject.transform.GetChild(0).up; bullet.GetComponent <Projectile>().Damage = Stats.Damage; bullet.SetActive(true); } break; case Turrets.Double: Stats.FireRate = .3f; int amount = 2; GameObject[] bullets = new GameObject[2]; for (int i = 0; i < amount; i++) { bullets[i] = ObjectPooler.Instance.GetPlayerProjectileObject(); if (bullets[i] != null && i == 0) { bullets[i].transform.position = gameObject.transform.GetChild(1).position; bullets[i].transform.rotation = gameObject.transform.GetChild(1).rotation; bullets[i].GetComponent <Projectile>().MoveDirection = gameObject.transform.GetChild(0).up; bullets[i].GetComponent <Projectile>().Damage = Stats.Damage; bullets[i].SetActive(true); } else if (bullets[i] != null && i == 1) { bullets[i].transform.position = gameObject.transform.GetChild(2).position; bullets[i].transform.rotation = gameObject.transform.GetChild(2).rotation; bullets[i].GetComponent <Projectile>().MoveDirection = gameObject.transform.GetChild(0).up; bullets[i].GetComponent <Projectile>().Damage = Stats.Damage; bullets[i].SetActive(true); } } break; case Turrets.Triple: Stats.FireRate = .35f; int amount2 = 3; GameObject[] bullets2 = new GameObject[3]; for (int i = 0; i < amount2; i++) { bullets2[i] = ObjectPooler.Instance.GetPlayerProjectileObject(); if (bullets2[i] != null && i == 0) { bullets2[i].transform.position = gameObject.transform.GetChild(1).position; bullets2[i].transform.rotation = gameObject.transform.GetChild(1).rotation; bullets2[i].GetComponent <Projectile>().MoveDirection = gameObject.transform.GetChild(0).up; bullets2[i].GetComponent <Projectile>().Damage = Stats.Damage; bullets2[i].SetActive(true); } else if (bullets2[i] != null && i == 1) { bullets2[i].transform.position = gameObject.transform.GetChild(2).position; bullets2[i].transform.rotation = gameObject.transform.GetChild(2).rotation; bullets2[i].GetComponent <Projectile>().MoveDirection = gameObject.transform.GetChild(0).up; bullets2[i].GetComponent <Projectile>().Damage = Stats.Damage; bullets2[i].SetActive(true); } else if (bullets2[i] != null && i == 2) { bullets2[i].transform.position = gameObject.transform.GetChild(0).position; bullets2[i].transform.rotation = gameObject.transform.GetChild(0).rotation; bullets2[i].GetComponent <Projectile>().MoveDirection = gameObject.transform.GetChild(0).up; bullets2[i].GetComponent <Projectile>().Damage = Stats.Damage; bullets2[i].SetActive(true); } } break; default: throw new ArgumentOutOfRangeException(nameof(turrets), turrets, null); } if (_shotSFX != null) { AudioHandler.PlaySFX(_shotSFX); } }
private void Start() { TurretToBuild = testTurret; }
private void RemoveTurret(Turret t) { Turrets.Remove(t); }
void Start() { hull = GetComponent<Hull>(); turrets = GetComponent<Turrets>(); sails = GetComponent<Sails>(); }
public void EndBattle() { EndTimer(); if (Region is GuardedRegion) { ((GuardedRegion)Region).Disabled = false; } CooldownEnds = DateTime.UtcNow + TimeSpan.FromMinutes(Cooldown); ViceVsVirtueSystem.Instance.OnBattleEnd(); foreach (VvVAltar altar in Altars) { if (!altar.Deleted) { altar.Delete(); } } foreach (VvVTrap trap in Traps) { if (!trap.Deleted) { trap.Delete(); } } foreach (CannonTurret turret in Turrets) { if (!turret.Deleted) { turret.Delete(); } } if (VicePriest != null) { VicePriest.Delete(); VicePriest = null; } if (VirtuePriest != null) { VirtuePriest.Delete(); VirtuePriest = null; } if (Sigil != null) { Sigil.Delete(); Sigil = null; } Guild leader = GetLeader(); foreach (Mobile m in this.Region.GetEnumeratedMobiles()) { Guild g = m.Guild as Guild; if (leader != null && (g == leader || leader.IsAlly(g))) { System.AwardPoints(m, WinSilver + (OppositionCount(g) * 50), message: false); } } SendBattleStatsGump(); System.SendVvVMessage(1154722); // A VvV battle has just concluded. The next battle will begin in less than five minutes! Altars.Clear(); GuildStats.Clear(); KillCooldown.Clear(); Participants.Clear(); Participants.TrimExcess(); Messages.Clear(); Messages.TrimExcess(); Traps.Clear(); Traps.TrimExcess(); Warned.Clear(); Warned.TrimExcess(); Turrets.Clear(); Turrets.TrimExcess(); if (Region is GuardedRegion) { ((GuardedRegion)Region).Disabled = false; } OnGoing = false; NextSigilSpawn = DateTime.MinValue; LastOccupationCheck = DateTime.MinValue; NextAnnouncement = DateTime.MinValue; StartTime = DateTime.MinValue; NextAltarActivate = DateTime.MinValue; ManaSpikeEndEffects = DateTime.MinValue; NextManaSpike = DateTime.MinValue; }
public Ship(Ship ship) { TextureDictionary = ship.TextureDictionary; //Sprite Rotation = ship.Rotation; Position = ship.Position; Rectangle = ship.Rectangle; Origin = ship.Origin; Texture = ship.Texture; //End TextureIndexCounter = ship.TextureIndexCounter; ShipCurrentIndex = ship.ShipCurrentIndex; ShipPreviousIndex = ship.ShipPreviousIndex; Description = ship.Description; Name = ship.Name; Cost = ship.Cost; TurnRate = ship.TurnRate; Speed = ship.Speed; BackwardsSpeed = ship.BackwardsSpeed; StrafeSpeed = ship.StrafeSpeed; Boost = ship.Boost; Moving = ship.Moving; BaseHealth = ship.BaseHealth; Health = ship.Health; HealthMax = ship.HealthMax; BaseEnergy = ship.BaseEnergy; Energy = ship.Energy; EnergyMax = ship.EnergyMax; BaseEnergyRegen = ship.BaseEnergyRegen; EnergyRegen = ship.EnergyRegen; Upgrades = new Upgrade[ship.Upgrades.Length]; for (int i = 0; i < ship.Upgrades.Length; i++) { if (ship.Upgrades[i] == null) { continue; } Upgrades[i] = new Upgrade(ship.Upgrades[i]); } if (ship.TractorBeam != null) { TractorBeam = new TractorBeam(ship.TractorBeam); } foreach (var turretGroup in ship.Turrets) { Turrets.Add(turretGroup.Key, new List <ITurret>()); } foreach (var turretList in Turrets.Values) { foreach (var turretGroup in ship.Turrets) { foreach (var turret in turretGroup.Value) { turretList.Add(turret.CloneTurret(turret)); //TODO see if this can be don easier instead of implementing CloneTurret in every turret } } } }