public static void ApplyDamageDelayed(this Label label, Ksid damageType, float intensity) { if (label.KsidGet.IsChildOf(damageType)) { Game.Instance.GlobalTimerHandler.WithKsidFloatParams.Plan(0.3f, applyDamageAction, label, damageType, intensity); } }
public Placeable GetFirst(ref Cell cell, Ksid ksid) { foreach (var p in cell) { if (ksids.IsParentOrEqual(p.Ksid, ksid)) { return(p); } } return(null); }
public bool ContainsType(Vector2Int pos, Ksid ksid) { if (CellToCell(pos, out var cellPos)) { foreach (var p in cells[cellPos]) { if (ksids.IsParentOrEqual(p.Ksid, ksid)) { return(true); } } } return(false); }
public static void ApplyDamage(this Label label, Ksid damageType, float intensity) { var ksids = Game.Instance.Ksids; if (ksids.IsParentOrEqual(label.KsidGet, damageType)) { if (ksids.IsParentOrEqual(damageType, Ksid.CausesExplosion) && ksids.IsParentOrEqual(label.KsidGet, Ksid.Explosive)) { label.Explode(); } else { label.Kill(); } } }
public bool ContainsType(Vector2 pos, Vector2 size, Ksid ksid) { int tag = GetNextTag(); #region Coords Prep CopyPaste pos -= mapOffset; pos.Scale(CellSize2dInv); var pos2 = new Vector2(size.x * CellSize2dInv.x + pos.x, size.y * CellSize2dInv.y + pos.y); var posFl = Vector2Int.FloorToInt(pos); var pos2Cl = Vector2Int.CeilToInt(pos2); if (posFl.x == pos2Cl.x) { pos2Cl.x += 1; } if (posFl.y == pos2Cl.y) { pos2Cl.y += 1; } posFl = Vector2Int.Max(Vector2Int.zero, posFl); pos2Cl = Vector2Int.Min(mapSize, pos2Cl); int cellPosY = posFl.y * sizex; #endregion for (int y = posFl.y; y < pos2Cl.y; y++, cellPosY += sizex) { for (int x = posFl.x; x < pos2Cl.x; x++) { foreach (var p in cells[cellPosY + x]) { if (p.Tag != tag) { p.Tag = tag; if (ksids.IsParentOrEqual(p.Ksid, ksid)) { return(true); } } } } } return(false); }
public KsidNode(Ksid name, ushort component, Ksids builder) { Name = name; this.component = component; this.builder = builder; }
public static bool IsChildOfOrEq(this Ksid child, Ksid parent) => Game.Instance.Ksids.IsParentOrEqual(child, parent);