Exemple #1
0
 public void check()
 {
     if (MyTime.getInstance().passed - start >= ttl)
     {
         Dispose();
         MyTime.getInstance().remove(this);
     }
 }
Exemple #2
0
 public static MyTime getInstance()
 {
     if (instance == null)
     {
         instance = new MyTime();
     }
     return(instance);
 }
Exemple #3
0
        public static void demo()
        {
            Console.ReadKey();

            Hero h = new Hero();

            h.collect(new DexterityGem());
            h.collect(new IntelligenceGem());
            Console.WriteLine(h);
            Console.ReadKey();


            h.collect(new StrengthGem());
            h.collect(new LeapSlam());

            Console.WriteLine(h);
            Console.ReadKey();
            MyTime.getInstance().tick();

            Console.WriteLine(h);
            Console.ReadKey();
            MyTime.getInstance().tick();

            Console.WriteLine(h);
            Console.ReadKey();

            h.collect(new IntelligenceGem());
            h.collect(new StrengthGem());

            Console.WriteLine(h);
            Console.ReadKey();

            MyTime.getInstance().tick();
            MyTime.getInstance().tick();

            Console.WriteLine(h);

            Console.ReadKey();
        }
Exemple #4
0
 public Gem()
 {
     start = MyTime.getInstance().passed;
     ttl   = 3;
     MyTime.getInstance().add(this);
 }
Exemple #5
0
 private MyTime()
 {
     instance = this;
     passed   = 0;
     ihasTTLs = new IhasTTL[10];
 }
Exemple #6
0
 public void collect(Gem gem)
 {
     gem.apply(this);
     MyTime.getInstance().tick();
 }