private ResourceData GetResourceData(LiveActor actor) { var resfilepath = @"resources\" + ".xml"; // TODO: Use the ActorResourceInfo thats ready to implement in the actor-class var xmlReader = XmlReader.Create(resfilepath); return((ResourceData)xmlSerializer.Deserialize(xmlReader)); }
public void ApplyResourceData(LiveActor actor) { try { var resourceData = GetResourceData(actor); foreach (var resourceDataItem in resourceData.items) { switch (resourceDataItem.type) { case ResouceDataItem.ResourceDataType.Attributes: #region Attributes switch (resourceDataItem.name) { case "BaseMaxHealth": actor.baseMaxHealth = float.Parse(resourceDataItem.data.ToString()); break; case "BaseMaxStamina": actor.baseMaxMana = float.Parse(resourceDataItem.data.ToString()); break; case "BaseMovementspeed": actor.baseMovementspeed = float.Parse(resourceDataItem.data.ToString()); break; case "BaseArmor": actor.baseArmor = float.Parse(resourceDataItem.data.ToString()); break; default: Debug.LogWarning("The resource data of the npc \"" + actor.actorName + "\" has an invalid item: " + resourceDataItem.name + ", ignoring..."); break; } #endregion break; case ResouceDataItem.ResourceDataType.Items: actor.startItems.Add(resourceDataItem.data.ToString()); break; case ResouceDataItem.ResourceDataType.Buffs: actor.startItems.Add(resourceDataItem.data.ToString()); break; case ResouceDataItem.ResourceDataType.Abilities: actor.startItems.Add(resourceDataItem.data.ToString()); break; default: break; } } } catch (Exception ex) { Debug.LogError("An exception occured while applying the resource data of npc \"" + actor.actorName + "\": " + ex.ToString()); } }
public void ReceiveHeal(float amount, LiveActor healer) { if (amount < 0) { Debug.Log(healer.actorName + " tried to heal " + actorName + " by " + amount + " points, negative heals are invalid!"); return; } attributes[AttributeType.CurrentHealth] += amount; }
public void SetTarget(LiveActor actortarget) { if (actortarget == null) { target = null; return; } target = actortarget.transform; }
public void ReceiveDamage(float damage, DamageType type, LiveActor dd) { if (isImmortal) { Debug.Log(actorName + " currently is immortal and cant receive damage"); return; } if (damage > 0) { Debug.Log(dd.actorName + " tried to deal " + damage + " damage to " + actorName + ", positive damage is invalid!"); return; } float totalDamage = damage; // Change damage according to type switch (type) { case DamageType.Physical: // Special formula break; case DamageType.Pure: break; case DamageType.Poison: if (isPoisonImmune) { totalDamage = 0; } break; default: break; } attributes[AttributeType.CurrentHealth] -= totalDamage; if (isDead) { attributes[AttributeType.CurrentHealth] = 0; // If server OnDeath(); } }
public virtual void OnApply(LiveActor actor) { }
public AbilityInvokation(Vector3 targetposition, LiveActor targetactor, LiveActor invoker) { this.targetPosition = targetposition; this.targetActor = targetactor; this.invoker = invoker; }
public void Interact(LiveActor with) { }