i have a simple buff class and a generic list full of buffs. and i need to sort them but the
[reference for the list's sort function][1] says:
"Sorts the elements in the entire List using the default comparer."
i need to override the default comparer in my buff class so they are sorted how i intended, but i'm not sure what function's name is, so i can't start to override it.
this is the class:
#pragma strict
class Buff
{
var on: boolean;
var name: String;
var effect1: String;
var effect2: String;
var power1: float;
var power2: float;
var duration: float;
function Buff(newName:String, e1: String, e2: String, p1: float, p2: float, dur:float)
{
on = true;
name = newName;
effect1 = e1;
effect2 = e2;
power1 = p1;
power2 = p2;
duration = dur;
}
}
[1]: http://msdn.microsoft.com/en-us/library/b0zbh7b6.aspx
↧