public override bool ParseXmlAttribute(XmlAttribute _attribute) { bool based = base.ParseXmlAttribute(_attribute); string name = _attribute.Name; bool used = true; if (name == "scale") { string val = _attribute.Value; if (val.Contains(',')) { scale = StringParsers.ParseVector3(val); } else { float v = float.Parse(val); scale = v * Vectors.Float.One; } } else { used = false; } return(used || based); }
// Over-ride for CopyProperties to allow it to read in StartingQuests. public override void CopyPropertiesFromEntityClass() { base.CopyPropertiesFromEntityClass(); EntityClass entityClass = EntityClass.list[this.entityClass]; flEyeHeight = EntityUtilities.GetFloatValue(entityId, "EyeHeight"); // Read in a list of names then pick one at random. if (entityClass.Properties.Values.ContainsKey("Names")) { string text = entityClass.Properties.Values["Names"]; string[] Names = text.Split(','); int index = UnityEngine.Random.Range(0, Names.Length); strMyName = Names[index]; } if (entityClass.Properties.Values.ContainsKey("SleeperInstantAwake")) { isAlwaysAwake = true; } if (entityClass.Properties.Values.ContainsKey("Titles")) { string text = entityClass.Properties.Values["Titles"]; string[] Names = text.Split(','); int index = UnityEngine.Random.Range(0, Names.Length); strTitle = Names[index]; } if (entityClass.Properties.Classes.ContainsKey("Boundary")) { DisplayLog(" Found Bandary Settings"); String strBoundaryBox = "0,0,0"; String strCenter = "0,0,0"; DynamicProperties dynamicProperties3 = entityClass.Properties.Classes["Boundary"]; foreach (KeyValuePair <string, object> keyValuePair in dynamicProperties3.Values.Dict.Dict) { DisplayLog("Key: " + keyValuePair.Key); if (keyValuePair.Key == "BoundaryBox") { DisplayLog(" Found a Boundary Box"); strBoundaryBox = dynamicProperties3.Values[keyValuePair.Key]; continue; } if (keyValuePair.Key == "Center") { DisplayLog(" Found a Center"); strCenter = dynamicProperties3.Values[keyValuePair.Key]; continue; } } Vector3 Box = StringParsers.ParseVector3(strBoundaryBox, 0, -1); Vector3 Center = StringParsers.ParseVector3(strCenter, 0, -1); ConfigureBounaryBox(Box, Center); } }
public Vector3 dsi = new Vector3(4f, 1f, 1f); // duration, speed, interleave // NB: // - depends on entity mass ... // - (ghost) (4f, 1f, 1f) is very small (4f, 1f, 0f) is way too strong // - (4,2,1): very strong, but remains alive most of the time // todo: random duration / trigger on duration public override bool ParseXmlAttribute(XmlAttribute _attribute) { bool based = base.ParseXmlAttribute(_attribute); string name = _attribute.Name; bool used = true; if (name == "checkothers") { this.CheckOthers = bool.Parse(_attribute.Value); } if (name == "dirrandom") { this.dirrandom = float.Parse(_attribute.Value); } if (name == "strength") { this.strength = float.Parse(_attribute.Value); } if (name == "dsi") { this.dsi = StringParsers.ParseVector3(_attribute.Value); } else { used = false; } return(used || based); }
public override void Execute(List <string> _params, CommandSenderInfo _senderInfo) { /* * Direction not perfect, always moving up, jumping diagonally (issue of not waiting callback ?) * */ Entity target = GameManager.Instance.World.GetLocalPlayers()[0]; if (_params.Count > 0 && _params[0] == "sg") { Vector3 pos = target.GetPosition(); Vector3i ipos = Vectors.ToInt(pos); Printer.Print("pos: ", pos, "=>", ipos, "=>", Vectors.ToFloat(ipos)); Printer.Print("pos: ", ipos, "=>", Vectors.ToFloat(ipos), "=>", Vectors.ToInt(Vectors.ToFloat(ipos))); target.SetPosition(pos); // _MoveSetPos only return; // also check conversion in Emplacement } int check = 0; int eid = -1; Vector3 dir = Vectors.Float.UnitY; if (_params.Count > 0) { eid = int.Parse(_params[0]); } if (_params.Count > 1) { check = int.Parse(_params[1]); } if (_params.Count > 2) { dir = StringParsers.ParseVector3(_params[2]); } if (eid > 0) { target = GameManager.Instance.World.GetEntity(eid); } if (target == null) { Printer.Print("Entity not there ", eid); return; } Printer.Print("ConsoleCmdEMover", eid, check, dir); EntityMover mover = new EntityMover(3, 0.2f); // .Config(1); mover.checkCollision = check == 1; mover.Apply(target, dir); // This is a routine... so check not executed ... }
public override void Init() { base.Init(); if (this.Properties.Values.ContainsKey("ParticleName")) { this.particleName = this.Properties.Values["ParticleName"]; ConfigureParticles(this.particleName); } if (this.Properties.Values.ContainsKey("ParticleOffset")) { this.offset = StringParsers.ParseVector3(this.Properties.Values["ParticleOffset"], 0, -1); } }
public override void CopyPropertiesFromEntityClass() { this.npcID = "animalFarm"; base.CopyPropertiesFromEntityClass(); EntityClass entityClass = EntityClass.list[this.entityClass]; if (entityClass.Properties.Values.ContainsKey("BoundaryBox")) { Vector3 dim = StringParsers.ParseVector3(entityClass.Properties.Values["BoundaryBox"], 0, -1); ConfigureBounaryBox(dim); } InvokeRepeating("CheckAnimalEvent", 1f, 60f); }
public override bool ParseXmlAttribute(XmlAttribute _attribute) { bool based = base.ParseXmlAttribute(_attribute); string name = _attribute.Name; bool used = true; if (name == "particle") { this.particle = _attribute.Value; if (this.particle.StartsWith("p_")) { this.particle = this.particle.Substring(2); } } else if (name == "offset") { this.offset = StringParsers.ParseVector3(_attribute.Value); } else if (name == "rcol") { this.rcol = StringParsers.ParseVector3(_attribute.Value); } else if (name == "rpos") { this.rpos = StringParsers.ParseVector3(_attribute.Value); } else if (name == "sound") { this.sound = _attribute.Value; } else if (name == "color") { this.color = ParseColor(_attribute.Value); } else if (name == "rep") { this.rep = int.Parse(_attribute.Value); } else if (name == "dt") { this.dt = int.Parse(_attribute.Value); } else { used = false; } return(used || based); }
// Over-ride for CopyProperties to allow it to read in StartingQuests. public override void CopyPropertiesFromEntityClass() { base.CopyPropertiesFromEntityClass(); EntityClass entityClass = EntityClass.list[this.entityClass]; // Read in a list of names then pick one at random. if (entityClass.Properties.Values.ContainsKey("Names")) { string text = entityClass.Properties.Values["Names"]; string[] Names = text.Split(','); int index = random.Next(0, Names.Length); strMyName = Names[index]; } if (entityClass.Properties.Values.ContainsKey("Titles")) { string text = entityClass.Properties.Values["Titles"]; string[] Names = text.Split(','); int index = random.Next(0, Names.Length); strTitle = Names[index]; } if (entityClass.Properties.Values.ContainsKey("HireCost")) { HireCost = int.Parse(entityClass.Properties.Values["HireCost"]); } if (entityClass.Properties.Values.ContainsKey("HireCurrency")) { this.HireCurrency = ItemClass.GetItem(entityClass.Properties.Values["HireCurrency"], false); if (this.HireCurrency.IsEmpty()) { this.HireCurrency = ItemClass.GetItem("casinoCoin", false); } } this.lstHungryBuffs = ConfigureEntityClass("HungryBuffs", entityClass); this.lstThirstyBuffs = ConfigureEntityClass("ThirstyBuffs", entityClass); if (entityClass.Properties.Classes.ContainsKey("Boundary")) { DisplayLog(" Found Bandary Settings"); String strBoundaryBox = "0,0,0"; String strCenter = "0,0,0"; DynamicProperties dynamicProperties3 = entityClass.Properties.Classes["Boundary"]; foreach (KeyValuePair <string, object> keyValuePair in dynamicProperties3.Values.Dict.Dict) { DisplayLog("Key: " + keyValuePair.Key); if (keyValuePair.Key == "BoundaryBox") { DisplayLog(" Found a Boundary Box"); strBoundaryBox = dynamicProperties3.Values[keyValuePair.Key]; continue; } if (keyValuePair.Key == "Center") { DisplayLog(" Found a Center"); strCenter = dynamicProperties3.Values[keyValuePair.Key]; continue; } } Vector3 Box = StringParsers.ParseVector3(strBoundaryBox, 0, -1); Vector3 Center = StringParsers.ParseVector3(strCenter, 0, -1); ConfigureBounaryBox(Box, Center); } }