Mercurial > repos > snowblizz-super-API-ideas
annotate api/Objects/UnitMemberType.cs @ 259:35dc06030355
Re #270: Add multiple categories to API
* Add "category" attribute to army schema
* Add method to define category when adding unit to army
* Make army loading check new attribute and assign to correct category or main category
TODO: Write out category of unit to army file
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 19 May 2010 20:07:07 +0000 |
parents | cdda78975be1 |
children |
rev | line source |
---|---|
252
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
1 // This file (UnitMember.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2010 IBBoard |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
2 // |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
3 // // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
4 |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
5 using System; |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
6 |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
7 namespace IBBoard.WarFoundry.API.Objects |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
8 { |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
9 /// <summary> |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
10 /// A container object for representations of different unit member types, such as "Infantry", "Elite Infantry" and "Commoner". |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
11 /// The idea of the UnitMemberType is to define not just the <see>UnitType</see>s, but also the types of type, as Archer and Swordsmen |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
12 /// are often just differently equipped versions of the same member type (Infantry). |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
13 /// </summary> |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
14 public class UnitMemberType : WarFoundryObject |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
15 { |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
16 private Stats stats; |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
17 |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
18 public UnitMemberType(string typeID, string typeName, Stats typeStats) : base(typeID, typeName) |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
19 { |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
20 stats = typeStats; |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
21 } |
254
cdda78975be1
Fixes #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
252
diff
changeset
|
22 |
cdda78975be1
Fixes #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
252
diff
changeset
|
23 public string StatsID |
cdda78975be1
Fixes #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
252
diff
changeset
|
24 { |
cdda78975be1
Fixes #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
252
diff
changeset
|
25 get |
cdda78975be1
Fixes #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
252
diff
changeset
|
26 { |
cdda78975be1
Fixes #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
252
diff
changeset
|
27 return stats.StatsID; |
cdda78975be1
Fixes #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
252
diff
changeset
|
28 } |
cdda78975be1
Fixes #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
252
diff
changeset
|
29 } |
252
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
30 |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
31 /// <value> |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
32 /// The set of <see cref="Stat"/>s for the unit member type in a format that is valid for the game system. |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
33 /// </value> |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
34 public Stat[] StatsArray |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
35 { |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
36 get |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
37 { |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
38 return stats.StatsArray; |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
39 } |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
40 } |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
41 |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
42 public Stat[] StatsArrayWithName |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
43 { |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
44 get |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
45 { |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
46 Stat[] extendedStats = new Stat[stats.StatCount+1]; |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
47 extendedStats[0] = new Stat(new StatSlot("name"), Name); |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
48 stats.StatsArray.CopyTo(extendedStats, 1); |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
49 return extendedStats; |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
50 } |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
51 } |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
52 } |
a54da5a8b5bb
Re #268: Restructure stats for re-use
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
53 } |