public Unit(int Player, UnitTag Tag) { _Player = Player; isGoaled = false; UnitPosition = new List <double>() { 0, 0, 0 }; unitTag = Tag; _Attack = 0; _Defense = 0; _Speed = 0; switch (Tag) { case UnitTag.Knight: _Attack = 1; break; case UnitTag.HeavySoldier: _Attack = 1; _Defense = 1; _Speed = -1; break; case UnitTag.Guard: _Defense = 1; break; case UnitTag.Scout: _Attack = 1; _Defense = -1; _Speed = 1; break; } }
public static List <BlueprintUnit> SelectUnits(int cr, UnitTag tag) { int minCR = cr - 6; List <BlueprintUnit> list = BlueprintRoot.Instance.RE.UnitsForRandomEncounters.Where <BlueprintUnit>((Func <BlueprintUnit, bool>)(u => OwlcatRESelector.ContainsTag(u.GetComponent <AddTags>(), tag))).Where <BlueprintUnit>((Func <BlueprintUnit, bool>)(u => OwlcatRESelector.GetCR(u) >= minCR)).ToList <BlueprintUnit>(); int xp = OwlcatRESelector.GetXp(cr); int maxTotalXp = OwlcatRESelector.GetXp(cr + 1); int currentXp = 0; List <BlueprintUnit> blueprintUnitList = new List <BlueprintUnit>(); while (currentXp < xp) { list.RemoveAll((Predicate <BlueprintUnit>)(u => OwlcatRESelector.GetXp(u) > maxTotalXp - currentXp)); if (list.Count != 0) { BlueprintUnit unit = list.Random <BlueprintUnit>(); currentXp += OwlcatRESelector.GetXp(unit); blueprintUnitList.Add(unit); } else { break; } } return(blueprintUnitList); }
private void CreateNotFoundUnit(UnitTag tag, OutputUnitState serverUnit) { world.NewEntityWith(out UnitCreateEvent unitEvent); unitEvent.Position = serverUnit.Position.ToUnityVector(); unitEvent.UnitTag = tag; unitEvent.PlayerId = serverUnit.PlayerId; unitEvent.Id = serverUnit.Id; unitEvent.Health = serverUnit.Health; }
private void ShowUnitTag(ActionUnitData data) { GameObject tag = Instantiate(UnitTagTemplate, gameObject.transform, false); AllUnitTags.Add(tag); UnitTag ScriptTag = tag.transform.GetComponent <UnitTag>(); ScriptTag.tileUnitData = data; ScriptTag.SpawnCharacter(); }
public static bool ContainsTag([CanBeNull] AddTags unit, UnitTag tag) { if (unit == null) { return(false); } for (int index = 0; index < unit.Tags.Length; ++index) { if (tag == unit.Tags[index]) { return(true); } } return(false); }
public static bool ContainsTag([CanBeNull] AddTags unit, UnitTag tag) { if ((UnityEngine.Object)unit == (UnityEngine.Object)null) { return(false); } for (var index = 0; index < unit.Tags.Length; ++index) { if (tag == unit.Tags[index]) { return(true); } } return(false); }
public bool MoveUnit(MoveCommand cmd, int x, int y) { if (IsFree(x, y)) { UnitTag unit = grid[x][y]; if ((unit != null && cmd.player_id == unit.owner_id) && IsFree(x + cmd.mag_x, y + cmd.mag_y)) { grid[x][y] = null; grid[x + cmd.mag_x][y + cmd.mag_y] = unit; return(true); } } return(false); }
public static void SetFields(this UnitComponent unitComponent, GameObject obj, UnitTag tag, Guid guid) { unitComponent.Object = obj; unitComponent.Tag = tag; unitComponent.Guid = guid; }
public void Add(UnitTag shipTag) { ShipTags.Add(shipTag); }
public bool TestTag(UnitTag Tag) { return(ShipTags.Contains(Tag)); }