Hi there, I’m having some trouble changing the enum in one script with another. What I’m trying to do is to get the enemy character to switch his type enum when he uses an attack. However, it’s not choosing the right attack. Here are my scripts:
Script 1: Base attack which all attacks inherit from
[System.Serializable]
public class BaseAttack: MonoBehaviour
{
public string attackName;//name
public string attackDescription;//description
public float attackDamage;//Base Damage
public float attackCost;//ManaCost
public BaseEnemy BEnemy;
}
Script 2: The attack
public class EnemyAbility1 : BaseAttack
{
public EnemyAbility1()
{
attackName = "Enemy Ability";
attackDescription = "Enemy Ability";
attackDamage = 20f;
attackCost = 0;
BEnemy.EnemyType = BaseEnemy.Type.WATER;
}
}
Script 3: EnemyStateMachine which controls the enemy
void ChooseAction()
{
//Bunch of scripts here, but the important one in this context is the one below to run the type change
enemy.EnemyType = myAttack.chosenAttack.BEnemy.EnemyType;
}
Thanks in advance!