public SerializedNpc(GameObject gameObject) { position = new Position(gameObject.transform.position); WeaponShooting enemyShooting = gameObject.GetComponentInChildren <WeaponShooting>(); EnemyAI enemyNpc = gameObject.GetComponentInChildren <EnemyAI>(); NpcStats stats = gameObject.GetComponent <NpcStats>(); Npc npc = gameObject.GetComponentInChildren <Npc>(); maxHealth = stats.maxHealth; damage = stats.damage; armour = stats.armour; radiationResistance = stats.radiationResistance; movementSpeed = stats.movementSpeed; //stats.items = stats.items; experienceGained = stats.experienceGained; radius = npc.radius; dialogueFilename = npc.dialogueFilename; reaction = npc.reaction; questNames = new List <string>(); questStatuses = new List <QuestStatus>(); npc.quests.ForEach(quest => { questNames.Add(quest.title); questStatuses.Add(quest.status); }); attackSpeed = enemyShooting.meleeAttackSpeed; //weaponName = enemyShooting.weapon.name; chaseRadius = enemyNpc.chaseRadius; attackRadius = enemyNpc.attackRadius; meleeRadius = enemyNpc.meleeRadius; }
private void Sickness(NpcStats crewMember) { //TODO: If sickLevel of npc > 10, health is lost. //TODO: If sickLevel of npc > 20, attributes and health are lost. //TODO: If sickLevel of npc > 30 or health = 0, RIP, all npcs loses 10 of loyalty int sickLevel = crewMember.GetSickLevel(); if (sickLevel >= 10) { crewMember.OnDamageReceived(2); } if (sickLevel >= 20) { crewMember.OnDamageReceived(4); crewMember.DecreaseStats(); } if (sickLevel >= 30) { crewMember.OnDamageReceived(100); } if (crewMember.GetNpcCurrentHealth() <= 0) { playerCrew.Remove(crewMember); } }
private void HealInjuries(NpcStats crewMember) { if (crewMember.GetSickLevel() < 10 && crewMember.GetNpcCurrentHealth() < crewMember.GetNpcMaximunHealth()) { crewMember.Recover(); } }
public void Buy(NpcStats npc, GameObject shopItem) { if (npc.cost <= playerDataController.PlayerData.CurrentGold) { playerDataController.PlayerData.CurrentGold -= npc.cost; playerDataController.PlayerData.CurrentCrew.Add(npc); uiController.ResourcesChanged(playerDataController.PlayerData); shopItem.SetActive(false); } }
void SetStats(NpcStats stats) { stats.maxHealth = maxHealth; stats.damage = damage; stats.armour = armour; stats.radiationResistance = radiationResistance; stats.movementSpeed = movementSpeed; //stats.items = items; stats.experienceGained = experienceGained; }
public override void SetState(StateMachine sm) { if (stateMachine == null) { base.SetState(sm); aiPath = sm.GetComponent <AIPath>(); aiDestinationSetter = sm.GetComponent <AIDestinationSetter>(); } npcStats = stateMachine.enemyStats; wanderingTarget = stateMachine.virtualTarget; }
private void HealSickness(NpcStats crewMember) { //TODO: If medic in crew AND it has medicines, sick level of all decreasesx2. If not decreases. //If medic is sick, shit happens NpcStats medic = CheckForMedic(); if (medic != null && medic.GetSickLevel() < 10 && pDController.PlayerData.CurrentMedicine > 0) { pDController.PlayerData.CurrentMedicine -= 1; crewMember.DecreaseSicknessLevel(2); } }
private void ConsumeWater(NpcStats crewMember) { //TODO: Each npc drinks 3 waters per day, if not, sick level increases. if (pDController.PlayerData.CurrentWater > 0) { pDController.PlayerData.CurrentWater -= 1; } else { crewMember.IncreaseSicknessLevel(2); } }
private void ConsumeFood(NpcStats crewMember) { //TODO: Each npc eats 3 meals per day, if not, sick level increases. if (pDController.PlayerData.CurrentFood > 0) { pDController.PlayerData.CurrentFood -= 1; } else { crewMember.IncreaseSicknessLevel(1); } }
void FixedUpdate() { if (isMoving) { if (transform.position.x < 5.8f) { rb.MovePosition(transform.position + transform.right * Time.fixedDeltaTime * speed); } if (transform.position.y >= -2.0f && transform.position.y <= -0.6f) { goToDownBridge = true; goToUPBridge = false; } if (transform.position.y >= 0.1f && transform.position.y <= 2.5f) { goToDownBridge = false; goToUPBridge = true; } if (goToUPBridge) { if (transform.position.y < 1.55f) { rb.MovePosition(transform.position + transform.up * Time.fixedDeltaTime * speed); } } if (goToDownBridge) { if (transform.position.y < -1.5f) { rb.MovePosition(transform.position + transform.up * Time.fixedDeltaTime * speed); } } } if (isAttacking) { enemyScript = enemy.GetComponent <NpcStats>(); enemyScript.health += -1 * Time.deltaTime; } }
void FixedUpdate() { if (isMoving) { if (transform.position.x > -6.8f) { rb.MovePosition(transform.position - transform.right * Time.fixedDeltaTime * speed); } } if (isAttacking) { enemyScript = enemy.GetComponent <NpcStats>(); enemyScript.health += -1 * Time.deltaTime; } }
private static NpcStats GetNpcStats(XmlAttributeCollection collection) { // MUST be in ORDER NpcStats npcStats = new NpcStats(); npcStats.Str.Total = int.Parse(collection["str"].Value); npcStats.Dex.Total = int.Parse(collection["dex"].Value); npcStats.Int.Total = int.Parse(collection["int"].Value); npcStats.Luk.Total = int.Parse(collection["luk"].Value); npcStats.Hp.Total = long.Parse(collection["hp"].Value); npcStats.HpRegen.Total = int.Parse(collection["hp_rgp"].Value); npcStats.HpInv.Total = int.Parse(collection["hp_inv"].Value); npcStats.Sp.Total = int.Parse(collection["sp"].Value); npcStats.SpRegen.Total = int.Parse(collection["sp_rgp"].Value); npcStats.SpInv.Total = int.Parse(collection["sp_inv"].Value); npcStats.Ep.Total = int.Parse(collection["ep"].Value); npcStats.EpRegen.Total = int.Parse(collection["ep_rgp"].Value); npcStats.EpInv.Total = int.Parse(collection["ep_inv"].Value); npcStats.AtkSpd.Total = int.Parse(collection["asp"].Value); npcStats.MoveSpd.Total = int.Parse(collection["msp"].Value); npcStats.Attack.Total = int.Parse(collection["atp"].Value); npcStats.Evasion.Total = int.Parse(collection["evp"].Value); npcStats.Cap.Total = int.Parse(collection["cap"].Value); npcStats.Cad.Total = int.Parse(collection["cad"].Value); npcStats.Car.Total = int.Parse(collection["car"].Value); npcStats.Ndd.Total = int.Parse(collection["ndd"].Value); npcStats.Abp.Total = int.Parse(collection["abp"].Value); npcStats.JumpHeight.Total = int.Parse(collection["jmp"].Value); npcStats.PhysAtk.Total = int.Parse(collection["pap"].Value); npcStats.MagAtk.Total = int.Parse(collection["map"].Value); npcStats.PhysRes.Total = int.Parse(collection["par"].Value); npcStats.MagRes.Total = int.Parse(collection["mar"].Value); npcStats.MinAtk.Total = int.Parse(collection["wapmin"].Value); npcStats.MaxAtk.Total = int.Parse(collection["wapmax"].Value); npcStats.Damage.Total = int.Parse(collection["dmg"].Value); npcStats.Pierce.Total = int.Parse(collection["pen"].Value); npcStats.MountSpeed.Total = int.Parse(collection["rmsp"].Value); return(npcStats); }
private static NpcStats GetNpcStats(XmlAttributeCollection collection) { // MUST be in ORDER NpcStats npcStats = new NpcStats(); npcStats.Str = new NpcStat <int>(int.Parse(collection["str"].Value)); npcStats.Dex = new NpcStat <int>(int.Parse(collection["dex"].Value)); npcStats.Int = new NpcStat <int>(int.Parse(collection["int"].Value)); npcStats.Luk = new NpcStat <int>(int.Parse(collection["luk"].Value)); npcStats.Hp = new NpcStat <long>(long.Parse(collection["hp"].Value)); npcStats.HpRegen = new NpcStat <int>(int.Parse(collection["hp_rgp"].Value)); npcStats.HpInv = new NpcStat <int>(int.Parse(collection["hp_inv"].Value)); npcStats.Sp = new NpcStat <int>(int.Parse(collection["sp"].Value)); npcStats.SpRegen = new NpcStat <int>(int.Parse(collection["sp_rgp"].Value)); npcStats.SpInv = new NpcStat <int>(int.Parse(collection["sp_inv"].Value)); npcStats.Ep = new NpcStat <int>(int.Parse(collection["ep"].Value)); npcStats.EpRegen = new NpcStat <int>(int.Parse(collection["ep_rgp"].Value)); npcStats.EpInv = new NpcStat <int>(int.Parse(collection["ep_inv"].Value)); npcStats.AtkSpd = new NpcStat <int>(int.Parse(collection["asp"].Value)); npcStats.MoveSpd = new NpcStat <int>(int.Parse(collection["msp"].Value)); npcStats.Accuracy = new NpcStat <int>(int.Parse(collection["atp"].Value)); npcStats.Evasion = new NpcStat <int>(int.Parse(collection["evp"].Value)); npcStats.Cap = new NpcStat <int>(int.Parse(collection["cap"].Value)); npcStats.Cad = new NpcStat <int>(int.Parse(collection["cad"].Value)); npcStats.Car = new NpcStat <int>(int.Parse(collection["car"].Value)); npcStats.Ndd = new NpcStat <int>(int.Parse(collection["ndd"].Value)); npcStats.Abp = new NpcStat <int>(int.Parse(collection["abp"].Value)); npcStats.JumpHeight = new NpcStat <int>(int.Parse(collection["jmp"].Value)); npcStats.PhysAtk = new NpcStat <int>(int.Parse(collection["pap"].Value)); npcStats.MagAtk = new NpcStat <int>(int.Parse(collection["map"].Value)); npcStats.PhysRes = new NpcStat <int>(int.Parse(collection["par"].Value)); npcStats.MagRes = new NpcStat <int>(int.Parse(collection["mar"].Value)); npcStats.MinAtk = new NpcStat <int>(int.Parse(collection["wapmin"].Value)); npcStats.MaxAtk = new NpcStat <int>(int.Parse(collection["wapmax"].Value)); npcStats.Damage = new NpcStat <int>(int.Parse(collection["dmg"].Value)); npcStats.Pierce = new NpcStat <int>(int.Parse(collection["pen"].Value)); npcStats.MountSpeed = new NpcStat <int>(int.Parse(collection["rmsp"].Value)); return(npcStats); }