| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using UnityEngine;
- public class HumanCharacter : Character
- {
- public Weapon weaponPrefab; // Assign the weapon prefab in the inspector
- public GameObject arrowPrefab; // Assign the arrow prefab in the inspector
- protected override void InitializeStats()
- {
- MaxHealth = 20;
- CurrentHealth = MaxHealth;
- Attack = 8;
- Strength = 10; // Default strength
- Constitution = 5;
- Dexterity = 3;
- Wisdom = 2;
- Perception = 10; // Default perception
- InitModifier = -2;
- DamageModifier = 0;
- SpellModifier = 0;
- MovementSpeed = 10;
- ArmorClass = 10;
- }
- public override Weapon GetWeapon()
- {
- // Return null to trigger direct weapon creation in SpawnAndEquipWeapon
- return weaponPrefab == null ? CreateDirectWeapon() : weaponPrefab;
- }
- protected override Weapon CreateDirectWeapon()
- {
- // Create weapon directly without prefab system
- GameObject swordObject = new GameObject("Simple Sword");
- swordObject.transform.SetParent(this.transform, false);
- spawnedWeapon = swordObject.AddComponent<SimpleSword>();
- spawnedWeapon.SetWielder(this);
- return spawnedWeapon;
- }
- public override Character Spawn(int count)
- {
- name = "Human";
- CharacterName = "Human";
- if (count > 1)
- {
- name += " " + count;
- CharacterName += " " + count;
- }
- return this;
- }
- }
|