void SendFiremanTo(Node fire) { List <Node> entrances = CheckAdjRoads(); Structure str = world.Map.GetBuildingAt(fire).GetComponent <Structure>(); if (entrances.Count == 0) { return; } Node start = entrances[0]; GameObject go = Instantiate(Resources.Load <GameObject>("Walkers/Fireman")); go.transform.position = start.GetVector3(); go.name = "FiremanFrom_" + name; Carryer c = go.GetComponent <Carryer>(); c.world = world; c.Origin = this; c.Destination = str; c.Path = c.FindPath(start, fire); c.Activate(); }
public void Evolve(Character.Age age) { if (Carryer != null) { Carryer.Drop(); } GameObject newYoung = maleYoungPrefab; switch (growTo) { case GrowTo.Random: newYoung = Random.value > 0.5f ? maleYoungPrefab : femaleYoungPrefab; break; case GrowTo.Male: newYoung = maleYoungPrefab; break; case GrowTo.Female: newYoung = femaleYoungPrefab; break; } Instantiate(newYoung, transform.position, Quaternion.identity); Destroy(gameObject); CharacterManager.OnKillCharacter(this); }
protected override void Trigger() { base.Trigger(); for (int i = 0; i < CharacterManager.Characters.Count; i++) { Character defender = CharacterManager.Characters[i]; if (Carryer.Match(Affect, defender) && GTTools.GetHorizontalDistance(Carryer.Pos, defender.Pos) <= Radius) { CharacterHelper.CalcAddBuff(Carryer, defender, BuffID); } } }
protected override void Trigger() { base.Trigger(); for (int i = 0; i < GTWorld.Characters.Count; i++) { Character defender = GTWorld.Characters[i]; if (Carryer.Match(Affect, defender) && GTTools.GetHorizontalDistance(Carryer.Pos, defender.Pos) <= Radius) { CharacterHelper.CalcDamage(Carryer, defender, null, Type, Percent, FixValue, IgnoreDefense); } } }
protected override void Trigger() { base.Trigger(); for (int i = 0; i < GTWorld.Characters.Count; i++) { Character defender = GTWorld.Characters[i]; if (Carryer.Match(Affect, defender) && GTTools.GetHorizontalDistance(Carryer.Pos, defender.Pos) <= Radius) { CharacterHelper.CalcHeal(Type, Carryer, defender, string.Empty, Percent, FixValue); } } }
public override void Execute() { for (int i = 0; i < Children.Count; i++) { ActBuffItem child = Children[i]; child.Execute(); } this.Status = EActStatus.RUNNING; if (Carryer.IsDead()) { Stop(); } }
public void SpawnGetter(ItemOrder io, Structure s) { Node start = CheckAdjRoads()[0]; Node stop = s.CheckAdjRoads()[0]; GameObject go = Instantiate(Resources.Load <GameObject>("Walkers/GetterCart")); go.transform.position = start.GetVector3(); go.name = "CartFrom_" + name; Carryer c = go.GetComponent <Carryer>(); c.world = world; c.Order = io; c.Origin = this; c.Destination = s; c.Path = c.FindPath(start, stop); c.Activate(); }
public override bool Check() { if (Carryer.IsDivive) { return(false); } if (Carryer.IsRide) { return(false); } if (Carryer.FSM == FSMState.FSM_FROST) { return(true); } if (Carryer.IsFSMLayer3()) { return(false); } return(true); }
public Carryer SpawnGiverToGenerator(ItemOrder io) { List <Node> entrances = GetAdjRoadTiles(); if (entrances.Count == 0) { return(null); } Node start = entrances[0]; SimplePriorityQueue <Generator> queue = FindGeneratorToAccept(io); for (int i = 0; queue.Count > 0 && i < 5 && !ActiveSmartWalker; i++) { Structure strg = queue.Dequeue(); List <Node> exits = strg.GetAdjRoadTiles(); if (exits.Count == 0) { continue; } Queue <Node> path = pathfinder.FindPath(start, exits, "GiverCart"); if (path.Count == 0) { continue; } GameObject go = world.SpawnObject("Walkers", "GiverCart", start); Carryer c = go.GetComponent <Carryer>(); c.world = world; c.Order = io; c.Origin = this; c.Destination = strg; c.Activate(); c.SetPath(path); return(c); } return(null); }
public void GetOrRemove() { //count through inventory so long as carryerwalker isn't active for (int a = 0; a < NumOfTotalTypes; a++) { //only keep going if WillGet[a] is true if (!WillGet[a]) { continue; } //if empty space, find other storage with stuff if (EmptySpaceFor(a) > (stockpile * .90f * WillAccept[a])) { ItemOrder io = new ItemOrder(EmptySpaceFor(a), a, typeStored); //if building is found, send getter SpawnGetterToStorage(io); } //else find storage to accept surplus else if (Inventory[a] > stockpile * WillAccept[a]) { int amountToRemove = (int)(Inventory[a] - (stockpile * WillAccept[a])); ItemOrder io = new ItemOrder(amountToRemove, a, typeStored); //if building is found, remove stuff from inventory and send giver Carryer cart = SpawnGiverToStorage(io); if (!ActiveSmartWalker) { return; } StorageBuilding strg = (StorageBuilding)cart.Destination; RemoveItem(io); UpdateVisibleGoods(); } } }