internal static ent GetEnt(vector pos, string id) { ent ent = null; if (string.IsNullOrEmpty(_dataset)) { log.WriteLine("no dataset defined for level file."); return(null); } using (var oReader = new StreamReader(filesystem.Open(_dataset), Encoding.GetEncoding("ISO-8859-1"))) { _datasetDoc = new XmlDocument(); _datasetDoc.Load(oReader); var e = _datasetDoc.SelectSingleNode("//dataset/ents/*[@id='" + id + "']"); if (e == null) { return(null); } var type = e.Name; if (type == "sprite") { ParseSprite(ref ent, pos, e); } else if (type == "entity") { ParseEntity(ref ent, pos, e); } } return(ent); }
private static void Genent(ent e, bool fresh) { if (fresh || e.isstatic) { world.AddEnt(e); } }
private static void ParseSprite(ref ent ent, vector pos, XmlNode node) { var s = new sprite(pos); foreach (XmlNode n in node.ChildNodes) { try { if (n.Name == "static") { s.isstatic = n.InnerText == "true"; } if (n.Name == "solid") { s.solid = n.InnerText == "true"; } if (n.Name == "texture") { s.SetTexture(n.InnerText); } if (n.Name == "offset") { s.SetPos(s.pos + ParseVector(n.InnerText)); } } catch (Exception e) { log.WriteLine("parsing error: " + e.Message); } } ent = s; }
/// <summary> /// Called by the pickup processor when the object is "picked up" (interaction button pressed) /// </summary> /// <param name="character">The character entity that picked up that item</param> /// <param name="loot">The loot entity that picked up</param> public virtual void Pickup(ent character, ent loot) { SFXManager.PlaySound(SFXManager.Use.Sound2D, new SFXManager.PlayData() { Clip = SFXManager.PickupSound }); }
public static void Exit(ent entity) { entity.Set(Tag.Exit); entity.Get <ComponentObject>(); entity.InitComponentObject(); }
public static bool CanHearPlayer(ent e, int distance) { var pvec = world.Player.pos.Floor(); var pvs = GetPvs(e.pos, distance); return(pvs.Contains(pvec)); }
public void UnequippedBy(ent character) { foreach (var effect in equippedEffects) { effect.Removed(character); } }
public static bool CanSeePlayer(ent e, int cone, int radius) { var pvec = world.Player.pos.Floor(); var pvs = GetPvs(e.pos, (int)e.angle, cone, radius); return(pvs.Contains(pvec)); }
public static void ResetData(string file, bool fresh, bool clearents) { mapfile = file; log.WriteLine("loading map.. " + file); ent p = null; if (!fresh) { p = Player; } if (clearents || entities == null) { ClearEnts(); } if (!fresh) { entities.Add(p); } clock = new Stopwatch(); texAliascache = new List <string>(255); clock.Restart(); startingSec = 0; }
public async Task <IActionResult> PutEnt(string id, ent ent) { if (id != ent.name) { return(BadRequest()); } _context.Entry(ent).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!entExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public override void Pickup(ent character, ent loot) { base.Pickup(character, loot); var hasAmmo = loot.Has <ComponentWeapon>(); ref var cWeapon = ref character.Get <ComponentWeapon>();
public static void InitComponentObject(this ent entity) { var cObject = entity.ComponentObject(); cObject.position = entity.transform.position; cObject.collider = entity.GetMono <Collider2D>("collider"); cObject.renderer = entity.GetMono <SpriteRenderer>("view"); }
public override void Applied(ent target) { base.Applied(target); //We use the fire effect as it's the only one existing in the project. //You can add new VFX and use an if or switch statement to use the right VFXType //depending on this effect m_DamageType // m_FireInstance = VFXManager.GetVFX(VFXType.FireEffect); _fireInstance.Effect.transform.position = target.transform.position + Vector3.up; }
public static void Wall(ent entity) { entity.Set(Tag.Wall); entity.Get <ComponentObject>(); entity.InitComponentObject(); var cHealth = entity.Get <ComponentHealth>(); cHealth.count = 5; }
public override void OnAttack(ent target, ent user, ref AttackData attackData) { if (!(Random.value < PercentageChance / 100.0f)) { return; } attackData.AddDamage(StatSystem.DamageType.Cold, Damage); Debug.Log("Chill effect is applied"); }
public override bool UsedBy(ent character) { var wasUsed = false; foreach (var effect in UsageEffects) { wasUsed |= effect.Use(character); } return(wasUsed); }
public void TickFixed(float delta) { foreach (var character in _characters) { var col = character.GetMono <CapsuleCollider>(); var transform = character.transform; var(top, bottom) = GetCapsuleBounds(col, transform); var hits = Physics.OverlapCapsuleNonAlloc(top, bottom, 2.5f, _lootColliders, LayerMask.GetMask("Collectable")); if (hits == 0) { if (_lootEntity.id != -1) { _lootEntity.RemoveAll(Tag.Lootable); } _lootEntity = new ent(-1); continue; } var newEntity = _lootColliders[0].gameObject.GetEntity(); if (_lootEntity.id == newEntity.id) { return; } if (!newEntity.Has(Tag.Lootable)) { newEntity.Set(Tag.Lootable); } if (_lootEntity.id != -1 && _lootEntity.Has(Tag.Lootable)) { _lootEntity.RemoveAll(Tag.Lootable); } _lootEntity = newEntity; } }
public static bool GetEntity(out ent entity, Vector2 position, Vector2 direction, float distance, int mask) { var hit = Physics2D.Raycast(position, direction, distance, mask); if (hit) { var index = HelperArray.BinarySearch(ref buffer.pointers, hit.collider.GetHashCode(), 0, buffer.length); if (index == -1) { entity = new ent(-1); return(false); } entity = buffer.entities[index]; return(true); } entity = new ent(-1); return(false); }
public async Task <ActionResult <ent> > PostEnt(ent ent) { _context.Ents.Add(ent); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (entExists(ent.name)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("Getent", new { id = ent.name }, ent)); }
public static bool HasSolidColliderInPoint(Vector2 pos, int mask, out ent entity) { entity = default; var hit = OverlapPoint2D(pos, mask); if (hit > 0) { var index = HelperArray.BinarySearch(ref buffer.pointers, colliders[0].GetHashCode(), 0, buffer.length); if (index != -1) { entity = buffer.entities[index]; } if (colliders[0].isTrigger) { return(false); } return(true); } return(false); }
private static void ParseEntity(ref ent ent, vector pos, XmlNode node) { var prog = node.Attributes["prog"].InnerXml; int id; if (string.IsNullOrEmpty(prog) || !int.TryParse(prog.Replace("\"", ""), out id)) { log.WriteLine("failed to parse entity. prog attribute invalid."); return; } var s = (ent)progs.CreateEnt(id, pos); foreach (XmlNode n in node.ChildNodes) { if (n.Name == "offset") { s.SetPos(s.pos + ParseVector(n.InnerText)); } } ent = s; }
// explicit hulls in the BSP model return(CM_InlineModel(ent->s.modelindex));
public virtual void Applied(ent target) { _timer = _duration; _target = target; }
//return true if could be used, false otherwise. public abstract bool Use(ent character);
public static void MoveTo(ent entity, Vector2 target) { ref var cObject = ref entity.ComponentObject();
public void Init(ent owner) { stats.Copy(baseStats); CurrentHealth = stats.health; _owner = owner; }
public void Setup(ent entity, bool isAlive) { this.entity = entity; this.isAlive = isAlive; }
public static void Bind(this ent entity, DataEnemy dataEnemy) { Dataset[entity.id] = dataEnemy; }
public virtual void Launch(ent character) { }
protected override void OnModelCreating(ModelBuilder modelBuilder) { //TODO ent ent1 = new ent { name = "Entity01" }; ent ent2 = new ent { name = "Entity02" }; ent ent3 = new ent { name = "Entity03" }; ent ent4 = new ent { name = "Entity04" }; ent ent5 = new ent { name = "Entity05" }; ent ent6 = new ent { name = "Entity06" }; ent ent7 = new ent { name = "Entity07" }; ent ent8 = new ent { name = "Entity08" }; ent ent9 = new ent { name = "Entity09" }; ent ent10 = new ent { name = "Entity10" }; ent ent11 = new ent { name = "Entity11" }; ent ent12 = new ent { name = "Entity12" }; ent ent13 = new ent { name = "Entity13" }; ent ent14 = new ent { name = "Entity14" }; ent ent15 = new ent { name = "Entity15" }; ent ent16 = new ent { name = "Entity16" }; ent ent17 = new ent { name = "Entity17" }; ent ent18 = new ent { name = "Entity18" }; ent ent19 = new ent { name = "Entity19" }; ent ent20 = new ent { name = "Entity20" }; var ids = new ent[] { ent1, ent2, ent3, ent4, ent5, ent6, ent7, ent8, ent9, ent10, ent11, ent12, ent13, ent14, ent15, ent16, ent17, ent18, ent19, ent20 }; modelBuilder.Entity <ent>().HasData(ids); base.OnModelCreating(modelBuilder); }