public UnitActionProto ConvertToProto() { UnitActionProto pd = new UnitActionProto(); pd.roleID = roleID; pd.idleState = idleState; return pd; }
public void Parse(UnitActionProto proto) { roleID = proto.roleID; idleState = proto.idleState; StateList.Clear(); foreach (var actionStateProto in proto.actions) { ActionStateHeader ash = new ActionStateHeader(); ash.Parse(actionStateProto); StateList.Add(ash); } DefList.Clear(); foreach (var attackDefProto in proto.atkDefList) { AttackDefHeader adh = new AttackDefHeader(); adh.Parse(attackDefProto); DefList.Add(adh); } }
public static int FindActionIndex(UnitActionProto data, int stateId) { if (data == null) return -1; for (int i = 0; i < data.actions.Count; ++i) { if (data.actions[i].stateID == stateId) { return i; } } return -1; }