private CharacterGrade IdentifyCharacterGrade(CharacterGrade donorType, CharacterGrade recipientType) { int gradeValue = (int)donorType + (int)recipientType; if (gradeValue > maxValue) { gradeValue = maxValue; } return((CharacterGrade)gradeValue); }
public CharacterInfo(string name, int level, string description, float health, float damage, float shield, float speed, Sprite icon, CharacterGrade grade) { Name = name; Level = level; Description = description; Health = health; Damage = damage; Shield = shield; Speed = speed; Icon = icon; Grade = grade; }
// Спаривание персонажей public bool PairCharacters(Character donor, Character recipient) { if (CanPair(donor, recipient)) { CharacterType type = IdentifyCharacterType(donor.type, recipient.type); CharacterGrade grade = IdentifyCharacterGrade(donor.grade, recipient.grade); List <Character> list = null; switch (type) { case CharacterType.SAINT: list = saints; break; case CharacterType.SATAN: list = satans; break; case CharacterType.MIXED: //TODO добавить инициализацию листом mixed (если он появится) break; } if (list != null) { Vector3 pos = recipient.transform.position; Destroy(donor.gameObject); Destroy(recipient.gameObject); selectedChar = Instantiate(list[((int)grade) - 1], pos, Quaternion.identity); return(true); } } return(false); }