Esempio n. 1
0
        public static Unit DeSerialize(int ID, Vector3 wPos, bool use = true)
        {
            Unit unit = null;

            if (ID == 62 || ID == 74 || ID == 86 || ID == 98)
            {
                unit = King.DeSerialize(ID, wPos, use);
                return(unit);
            }

            var name  = Name.ARCHER;
            var color = Army.Color.BLACK;

            switch (ID)
            {
            case 53:
                name  = Name.SOLDIER;
                color = Army.Color.BLACK;
                break;

            case 54:
                name  = Name.ARCHER;
                color = Army.Color.BLACK;
                break;

            case 55:
                name  = Name.ELEMENTAL;
                color = Army.Color.BLACK;
                break;

            case 56:
                name  = Name.SORCERESS;
                color = Army.Color.BLACK;
                break;

            case 57:
                name  = Name.WISP;
                color = Army.Color.BLACK;
                break;

            case 58:
                name  = Name.DIREWOLF;
                color = Army.Color.BLACK;
                break;

            case 59:
                name  = Name.GOLEM;
                color = Army.Color.BLACK;
                break;

            case 60:
                name  = Name.CATAPULT;
                color = Army.Color.BLACK;
                break;

            case 61:
                name  = Name.DRAGON;
                color = Army.Color.BLACK;
                break;

            case 63:
                name  = Name.SKELETON;
                color = Army.Color.BLACK;
                break;

            case 64:
                name  = Name.CRYSTAL;
                color = Army.Color.BLACK;
                break;

            case 65:
                name  = Name.SOLDIER;
                color = Army.Color.BLUE;
                break;

            case 66:
                name  = Name.ARCHER;
                color = Army.Color.BLUE;
                break;

            case 67:
                name  = Name.ELEMENTAL;
                color = Army.Color.BLUE;
                break;

            case 68:
                name  = Name.SORCERESS;
                color = Army.Color.BLUE;
                break;

            case 69:
                name  = Name.WISP;
                color = Army.Color.BLUE;
                break;

            case 70:
                name  = Name.DIREWOLF;
                color = Army.Color.BLUE;
                break;

            case 71:
                name  = Name.GOLEM;
                color = Army.Color.BLUE;
                break;

            case 72:
                name  = Name.CATAPULT;
                color = Army.Color.BLUE;
                break;

            case 73:
                name  = Name.DRAGON;
                color = Army.Color.BLUE;
                break;

            case 75:
                name  = Name.SKELETON;
                color = Army.Color.BLUE;
                break;

            case 76:
                name  = Name.CRYSTAL;
                color = Army.Color.BLUE;
                break;

            case 77:
                name  = Name.SOLDIER;
                color = Army.Color.GREEN;
                break;

            case 78:
                name  = Name.ARCHER;
                color = Army.Color.GREEN;
                break;

            case 79:
                name  = Name.ELEMENTAL;
                color = Army.Color.GREEN;
                break;

            case 80:
                name  = Name.SORCERESS;
                color = Army.Color.GREEN;
                break;

            case 81:
                name  = Name.WISP;
                color = Army.Color.GREEN;
                break;

            case 82:
                name  = Name.DIREWOLF;
                color = Army.Color.GREEN;
                break;

            case 83:
                name  = Name.GOLEM;
                color = Army.Color.GREEN;
                break;

            case 84:
                name  = Name.CATAPULT;
                color = Army.Color.GREEN;
                break;

            case 85:
                name  = Name.DRAGON;
                color = Army.Color.GREEN;
                break;

            case 87:
                name  = Name.SKELETON;
                color = Army.Color.GREEN;
                break;

            case 88:
                name  = Name.CRYSTAL;
                color = Army.Color.GREEN;
                break;

            case 89:
                name  = Name.SOLDIER;
                color = Army.Color.RED;
                break;

            case 90:
                name  = Name.ARCHER;
                color = Army.Color.RED;
                break;

            case 91:
                name  = Name.ELEMENTAL;
                color = Army.Color.RED;
                break;

            case 92:
                name  = Name.SORCERESS;
                color = Army.Color.RED;
                break;

            case 93:
                name  = Name.WISP;
                color = Army.Color.RED;
                break;

            case 94:
                name  = Name.DIREWOLF;
                color = Army.Color.RED;
                break;

            case 95:
                name  = Name.GOLEM;
                color = Army.Color.RED;
                break;

            case 96:
                name  = Name.CATAPULT;
                color = Army.Color.RED;
                break;

            case 97:
                name  = Name.DRAGON;
                color = Army.Color.RED;
                break;

            case 99:
                name  = Name.SKELETON;
                color = Army.Color.RED;
                break;

            case 100:
                name  = Name.CRYSTAL;
                color = Army.Color.RED;
                break;

            default: return(null);
            }
            if (!Army.dict[color])
            {
                return(null);
            }

            unit               = New(name, Army.dict[color], wPos);
            unit.experience    = 0f;
            unit.healthUI.text = unit.changeHealthUI.text = "";
            if (use)
            {
                unit.Use();
            }
            return(unit);
        }