/// <summary> /// For Design-time only /// </summary> public LivingObject() : this(null, new ObjectID(ObjectType.Living, 1234)) { var r = new Random(); var props = new Tuple<PropertyID, object>[] { new Tuple<PropertyID, object>(PropertyID.Name, "Testname"), new Tuple<PropertyID, object>(PropertyID.Gender, LivingGender.Male), new Tuple<PropertyID, object>(PropertyID.MaterialID, MaterialID.Flesh), }; var data = new LivingData() { ObjectID = new ObjectID(ObjectType.Living, (uint)r.Next(5000)), LivingID = Dwarrowdelf.LivingID.Dwarf, CreationTick = r.Next(), CreationTime = DateTime.Now, Properties = props, }; ReceiveObjectData(data); var item = new ItemObject(); item.MoveTo(this, new IntPoint3()); ReceiveObjectDataEnd(); }
/// <summary> /// For Design-time only /// </summary> public LivingObject() : this(null, new ObjectID(ObjectType.Living, 1234)) { var props = new KeyValuePair<PropertyID, object>[] { new KeyValuePair<PropertyID, object>(PropertyID.Name, "Testname"), new KeyValuePair<PropertyID, object>(PropertyID.Gender, LivingGender.Male), new KeyValuePair<PropertyID, object>(PropertyID.MaterialID, MaterialID.Flesh), }; var data = new LivingData() { ObjectID = new ObjectID(ObjectType.Living, 1234), LivingID = Dwarrowdelf.LivingID.Dwarf, CreationTick = 123, CreationTime = DateTime.Now, Properties = props, }; ReceiveObjectData(data); var item = new ItemObject(); item.MoveTo(this, new IntVector3()); ReceiveObjectDataEnd(); }
/// <summary> /// For Design-time only /// </summary> public LivingObject() : this(null, new ObjectID(ObjectType.Living, 1234)) { var props = new KeyValuePair <PropertyID, object>[] { new KeyValuePair <PropertyID, object>(PropertyID.Name, "Testname"), new KeyValuePair <PropertyID, object>(PropertyID.Gender, LivingGender.Male), new KeyValuePair <PropertyID, object>(PropertyID.MaterialID, MaterialID.Flesh), }; var data = new LivingData() { ObjectID = new ObjectID(ObjectType.Living, 1234), LivingID = Dwarrowdelf.LivingID.Dwarf, CreationTick = 123, CreationTime = DateTime.Now, Properties = props, }; ReceiveObjectData(data); var item = new ItemObject(); item.MoveTo(this, new IntVector3()); ReceiveObjectDataEnd(); }
public virtual void LoadData(LivingData data) { // First, set the data species = data.species; firstName = data.firstName; lastName = data.lastName; health = data.health; maxHealth = data.maxHealth; hairType = data.hairType; topType = data.topType; bottomType = data.bottomType; GetComponent <SpriteRenderer>().color = new Color(data.skinColorR, data.skinColorG, data.skinColorB); animator.hairRenderer.color = new Color(data.hairColorR, data.hairColorG, data.hairColorB); animator.topRenderer.color = new Color(data.topColorR, data.topColorG, data.topColorB); animator.bottomRenderer.color = new Color(data.bottomColorR, data.bottomColorG, data.bottomColorB); healthEffects = (data.healthEffects != null) ? data.healthEffects : new List <HealthEffect>(); Inventory inventory = GetComponent <Inventory>(); if (inventory != null) { inventory.SetItems(data.inventory); } // Then set other stuff transform.position = data.position; // Load spirte animator = GetComponent <LivingAnimator>(); animator.LoadSprites(); }
public override void SendTo(IPlayer player, ObjectVisibility visibility) { Debug.Assert(visibility != ObjectVisibility.None); var data = new LivingData(); CollectObjectData(data, visibility); player.Send(new Messages.ObjectDataMessage(data)); base.SendTo(player, visibility); player.Send(new Messages.ObjectDataEndMessage() { ObjectID = this.ObjectID }); }
public override void LoadData(LivingData data) { base.LoadData(data); HealthBar.instance.UpdateHealthBar(); HealthBar.instance.UpdateEffectImages(); }
private GoldenApp() { LivingData = new LivingData(); // Living Data }