/
Tutorial8.cs
2745 lines (2366 loc) · 111 KB
/
Tutorial8.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/************************************************************************************
* Copyright (c) 2008-2011, Columbia University
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the Columbia University nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY COLUMBIA UNIVERSITY ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* ===================================================================================
* Author: Ohan Oda (ohan@cs.columbia.edu)
*
*************************************************************************************/
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using GoblinXNA;
using GoblinXNA.Graphics;
using GoblinXNA.SceneGraph;
using Model = GoblinXNA.Graphics.Model;
using GoblinXNA.Graphics.Geometry;
using GoblinXNA.Device.Capture;
using GoblinXNA.Device.Vision;
using GoblinXNA.Device.Vision.Marker;
using GoblinXNA.Device.Util;
using GoblinXNA.Physics;
using GoblinXNA.Physics.Newton1;
using GoblinXNA.Helpers;
using GoblinXNA.UI.UI2D;
using GoblinXNA.UI;
namespace Tutorial8___Optical_Marker_Tracking
{
class Card
{
///variables
/*type will store one of three values: 'M', 'S' or 'T'
*defining the card as type monster, spell or trap respectively.*/
static char type;
/*model will store the data pertaining to the display of the monster
* on the marker representing this paricular Card.*/
MarkerNode model;
//TransformNode sprite;
static int baseAtk;
int lastAtk;
int attackPower;
int health;
int defaultHealth;
bool ko;
string name;
string effect;
/*
* contructor: initializes Card data structure.
* parameters:
* marker (int) - marker number that displays card
* type (char) - type of monster, can be 'M', 'S', or 'T'
* model (TransformNode) - TransformNode displayed on read marker
* atk (int) - attack power of monster
* health (int) - health of monster
*
* */
public Card(char ntype, MarkerNode nmodel, int atk, int nhealth, string nname, string neffect)
{
type = ntype;
model = nmodel;
//sprite = nsprite; --> add sprite parameter?
attackPower = atk;
baseAtk = atk;
lastAtk = atk;
health = nhealth;
defaultHealth = health;
ko = false;
name = nname;
effect = neffect;
}
//getType fetches type and returns it.
public char getType()
{
return type;
}
//getModel fetches model and returns it
public MarkerNode getModel()
{
return model;
}
/* DEBATABLE METHOD:
* In the case that the model of the monster would have to be changed somehow
* (i.e color of monster needs to be changed),
* this method exists to change the model in its entirety.
* parameter: newModel (TransformNode)
*
*
public void setSprite(TransformNode newSprite)
{
sprite = newSprite;
}*/
/* isAttackingMonster exists to update damage given to another monster
* parameter: target (Card data structure)
* NOTE: no need for an isBeingAttacked method since this method will
* always be called by the attacking monster to edit values in the target monster.
* */
public void attacking(Card target)
{
target.takeDamage(attackPower);
}
/* takeDamage is used to register damage taken and subtract from the health pool of a given monster.
* parameter: amount (int)
* return: int value holding amount of damage done to owner of destroyed card.
* */
public void takeDamage(int amount)
{
health -= amount;
if (health <= 0)
{
destroy();
}
}
public void setHealth(int amount)
{
health += amount;
if (health > defaultHealth)
health = defaultHealth;
}
public int getDefaultHealth()
{
return defaultHealth;
}
public int getAttackPower()
{
return attackPower;
}
public void buff(int amount)
{
lastAtk = attackPower;
attackPower += amount;
}
public void debuff(int amount)
{
lastAtk = attackPower;
attackPower -= amount;
if (attackPower < 0)
attackPower = 0;
}
public void setDefault()
{
attackPower = baseAtk;
}
public void setLast()
{
attackPower = lastAtk;
lastAtk = baseAtk;
}
public string getName()
{
return name;
}
public string getEffect()
{
return effect;
}
public int getHealth()
{
return health;
}
public void destroy()
{
ko = true;
}
public bool isKO()
{
return ko;
}
}
/// <summary>
/// This tutorial demonstrates how to use both the ALVAR and ARTag optical marker tracker
/// library with our Goblin XNA framework. Please read the README.pdf included with this
/// project before running this tutorial. If you're using ARTag, please remove calib.xml
/// from the solution explorer so that you can successfully build the project.
/// </summary>
public class Tutorial8 : Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics;
Scene scene;
MarkerNode cylinderMarkerNode100,
cylinderMarkerNode101, cylinderMarkerNode102, cylinderMarkerNode103, cylinderMarkerNode104,
cylinderMarkerNode105, cylinderMarkerNode106, cylinderMarkerNode107, cylinderMarkerNode108,
cylinderMarkerNode109, cylinderMarkerNode110, cylinderMarkerNode111, cylinderMarkerNode112,
cylinderMarkerNode113, cylinderMarkerNode114;
MarkerNode cylinderMarkerNode115, cylinderMarkerNode116, cylinderMarkerNode117,
cylinderMarkerNode118, cylinderMarkerNode119, cylinderMarkerNode120, cylinderMarkerNode121,
cylinderMarkerNode122, cylinderMarkerNode123, cylinderMarkerNode124, cylinderMarkerNode125,
cylinderMarkerNode126, cylinderMarkerNode127, cylinderMarkerNode128, cylinderMarkerNode129;
MarkerNode cylinderMarkerNode130, cylinderMarkerNode131;
MarkerNode cylinderMarkerNode132, cylinderMarkerNode133, cylinderMarkerNode134,
cylinderMarkerNode135,cylinderMarkerNode136, cylinderMarkerNode137, cylinderMarkerNode138,
cylinderMarkerNode139, cylinderMarkerNode140, cylinderMarkerNode141;
bool useStaticImage = false;
SpriteFont uiFont;
Card p1Monster1;
Card p1Monster2;
Card p1Monster3;
Card p2Monster1;
Card p2Monster2;
Card p2Monster3;
Card p1Spell;
Card p1Trap;
Card p2Spell;
Card p2Trap;
bool p1Turn = true;
bool p1NoTrap = false;
bool p2NoTrap = false;
bool p1NoMagic = false;
bool p2NoMagic = false;
bool p1NoAttack = false;
bool p2NoAttack = false;
int p1TrapEffectCnt = 0;
int p2TrapEffectCnt = 0;
int p1life = 50, p2life = 50;
string text = "";
bool p1Winner = false;
public Tutorial8()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}
Card[] cards = new Card[30];
string p1TrapFlag = "none";
string p2TrapFlag = "none";
string p1SpellFlag = "none";
string p2SpellFlag = "none";
/*state machine creation:
* * 0 = start splash page
* * 1 = turn in progress (game on!)
* * 2 = end phase
* * 3 = cleanup phase
* * 4 = end game
*/
int state = 1;
G2DPanel p1Frame, p2Frame;
G2DLabel p1LifeLab, p1m1LifeLab, p1m2LifeLab, p1m3LifeLab;
G2DLabel p2LifeLab, p2m1LifeLab, p2m2LifeLab, p2m3LifeLab;
/// <summary>
/// Allows the game to perform any initialization it needs to before starting to run.
/// This is where it can query for any required services and load any non-graphic
/// related content. Calling base.Initialize will enumerate through any components
/// and initialize them as well.
/// </summary>
protected override void Initialize()
{
base.Initialize();
// Initialize the GoblinXNA framework
State.InitGoblin(graphics, Content, "");
// Initialize the scene graph
scene = new Scene(this);
// Use the newton physics engine to perform collision detection
scene.PhysicsEngine = new NewtonPhysics();
// Multi-thread the marker tracking process
State.ThreadOption = (ushort)ThreadOptions.MarkerTracking;
// Set up optical marker tracking
// Note that we don't create our own camera when we use optical marker
// tracking. It'll be created automatically
SetupMarkerTracking();
// Set up the lights used in the scene
CreateLights();
// Create 3D objects
CreateObjects();
// Create the ground that represents the physical ground marker array
CreateGround();
Create2DGUI();
// Use per pixel lighting for better quality (If you using non NVidia graphics card,
// setting this to true may reduce the performance significantly)
scene.PreferPerPixelLighting = true;
// Enable shadow mapping
// NOTE: In order to use shadow mapping, you will need to add 'PostScreenShadowBlur.fx'
// and 'ShadowMap.fx' shader files as well as 'ShadowDistanceFadeoutMap.dds' texture file
// to your 'Content' directory
scene.EnableShadowMapping = true;
// Show Frames-Per-Second on the screen for debugging
State.ShowFPS = true;
}
private void CreateLights()
{
// Create a directional light source
LightSource lightSource = new LightSource();
lightSource.Direction = new Vector3(1, -1, -1);
lightSource.Diffuse = Color.White.ToVector4();
lightSource.Specular = new Vector4(0.6f, 0.6f, 0.6f, 1);
// Create a light node to hold the light source
LightNode lightNode = new LightNode();
lightNode.LightSource = lightSource;
scene.RootNode.AddChild(lightNode);
}
private void SetupMarkerTracking()
{
IVideoCapture captureDevice = null;
if (useStaticImage)
{
captureDevice = new NullCapture();
captureDevice.InitVideoCapture(0, FrameRate._30Hz, Resolution._800x600,
ImageFormat.R8G8B8_24, false);
((NullCapture)captureDevice).StaticImageFile = "testImage800x600.jpg";
}
else
{
// Create our video capture device that uses DirectShow library. Note that
// the combinations of resolution and frame rate that are allowed depend on
// the particular video capture device. Thus, setting incorrect resolution
// and frame rate values may cause exceptions or simply be ignored, depending
// on the device driver. The values set here will work for a Microsoft VX 6000,
// and many other webcams.
captureDevice = new DirectShowCapture2();
captureDevice.InitVideoCapture(0, FrameRate._60Hz, Resolution._640x480,
ImageFormat.R8G8B8_24, false);
}
// Add this video capture device to the scene so that it can be used for
// the marker tracker
scene.AddVideoCaptureDevice(captureDevice);
// Create an optical marker tracker that uses ALVAR library
ALVARMarkerTracker tracker = new ALVARMarkerTracker();
tracker.MaxMarkerError = 0.02f;
tracker.InitTracker(captureDevice.Width, captureDevice.Height, "calib.xml", 9.0);
// Set the marker tracker to use for our scene
scene.MarkerTracker = tracker;
// Display the camera image in the background. Note that this parameter should
// be set after adding at least one video capture device to the Scene class.
scene.ShowCameraImage = true;
}
private void CreateGround()
{
GeometryNode groundNode = new GeometryNode("Ground");
groundNode.Model = new Box(95, 59, 0.1f);
// Set this ground model to act as an occluder so that it appears transparent
groundNode.IsOccluder = true;
// Make the ground model to receive shadow casted by other objects with
// CastShadows set to true
groundNode.Model.ReceiveShadows = true;
Material groundMaterial = new Material();
groundMaterial.Diffuse = Color.Gray.ToVector4();
groundMaterial.Specular = Color.White.ToVector4();
groundMaterial.SpecularPower = 20;
}
private void Create2DGUI()
{
p1Frame = new G2DPanel();
p1Frame.Bounds = new Rectangle(0, 0, 150, 80);
p1Frame.Border = GoblinEnums.BorderFactory.LineBorder;
p1Frame.Transparency = 1.0f;
p1Frame.BackgroundColor = Color.CornflowerBlue;
//Generic Label: P1
G2DLabel p1Label = new G2DLabel("P1: ");
p1Label.Bounds = new Rectangle(10, 10, 10, 10);
p1Label.TextFont = uiFont;
//Life Point Label: P1
p1LifeLab = new G2DLabel();
p1LifeLab.Bounds = new Rectangle(25, 10, 20, 40);
p1LifeLab.Text = p1life.ToString() + " LP";
p1LifeLab.TextFont = uiFont;
//Generic Label: P1M1
G2DLabel p1m1StatLab = new G2DLabel("M1: ");
p1m1StatLab.Bounds = new Rectangle(10, 25, 10, 10);
p1m1StatLab.TextFont = uiFont;
//Status Label: P1M1
p1m1LifeLab = new G2DLabel();
p1m1LifeLab.Bounds = new Rectangle(25, 25, 20, 40);
p1m1LifeLab.TextFont = uiFont;
//Generic Label: P1M2
G2DLabel p1m2StatLab = new G2DLabel("M2: ");
p1m2StatLab.Bounds = new Rectangle(10, 40, 10, 10);
p1m2StatLab.TextFont = uiFont;
//Status Label: P1M2
p1m2LifeLab = new G2DLabel();
p1m2LifeLab.Bounds = new Rectangle(25, 40, 20, 40);
p1m2LifeLab.TextFont = uiFont;
//Generic Label: P1M3
G2DLabel p1m3StatLab = new G2DLabel("M3: ");
p1m3StatLab.Bounds = new Rectangle(10, 55, 10, 10);
p1m3StatLab.TextFont = uiFont;
//Status Label: P1M3
p1m3LifeLab = new G2DLabel();
p1m3LifeLab.Bounds = new Rectangle(25, 55, 20, 40);
p1m3LifeLab.TextFont = uiFont;
p1Frame.AddChild(p1Label);
p1Frame.AddChild(p1LifeLab);
p1Frame.AddChild(p1m1StatLab);
p1Frame.AddChild(p1m1LifeLab);
p1Frame.AddChild(p1m2StatLab);
p1Frame.AddChild(p1m2LifeLab);
p1Frame.AddChild(p1m3StatLab);
p1Frame.AddChild(p1m3LifeLab);
scene.UIRenderer.Add2DComponent(p1Frame);
p2Frame = new G2DPanel();
p2Frame.Bounds = new Rectangle(650, 0, 150, 80);
p2Frame.Border = GoblinEnums.BorderFactory.LineBorder;
p2Frame.Transparency = 1.0f;
p2Frame.BackgroundColor = Color.CornflowerBlue;
//Generic Label: P2
G2DLabel p2Label = new G2DLabel("P2: ");
p2Label.Bounds = new Rectangle(15, 10, 10, 10);
p2Label.TextFont = uiFont;
//Life Point Label: P2
p2LifeLab = new G2DLabel();
p2LifeLab.Bounds = new Rectangle(35, 10, 40, 40);
p2LifeLab.Text = p2life.ToString() + " LP";
p2LifeLab.TextFont = uiFont;
//Generic Label: P2M1
G2DLabel p2m1StatLab = new G2DLabel("M1: ");
p2m1StatLab.Bounds = new Rectangle(15, 25, 10, 10);
p2m1StatLab.TextFont = uiFont;
//Status Label: P2M1
p2m1LifeLab = new G2DLabel();
p2m1LifeLab.Bounds = new Rectangle(35, 25, 20, 40);
p2m1LifeLab.TextFont = uiFont;
//Generic Label: P2M2
G2DLabel p2m2StatLab = new G2DLabel("M2: ");
p2m2StatLab.Bounds = new Rectangle(15, 40, 10, 10);
p2m2StatLab.TextFont = uiFont;
//Status Label: P2M2
p2m2LifeLab = new G2DLabel();
p2m2LifeLab.Bounds = new Rectangle(35, 40, 20, 40);
p2m2LifeLab.TextFont = uiFont;
//Generic Label: P2M3
G2DLabel p2m3StatLab = new G2DLabel("M3: ");
p2m3StatLab.Bounds = new Rectangle(15, 55, 10, 10);
p2m3StatLab.TextFont = uiFont;
//Status Label: P2M3
p2m3LifeLab = new G2DLabel();
p2m3LifeLab.Bounds = new Rectangle(35, 55, 20, 40);
p2m3LifeLab.TextFont = uiFont;
p2Frame.AddChild(p2Label);
p2Frame.AddChild(p2LifeLab);
p2Frame.AddChild(p2m1StatLab);
p2Frame.AddChild(p2m1LifeLab);
p2Frame.AddChild(p2m2StatLab);
p2Frame.AddChild(p2m2LifeLab);
p2Frame.AddChild(p2m3StatLab);
p2Frame.AddChild(p2m3LifeLab);
scene.UIRenderer.Add2DComponent(p2Frame);
}
private void CreateObjects()
{
// Create a material to apply to the sphere model
Material sphereMaterial = new Material();
sphereMaterial.Diffuse = new Vector4(0, 0.5f, 0, 1);
sphereMaterial.Specular = Color.Green.ToVector4();
sphereMaterial.SpecularPower = 10;
Material sphereMaterial2 = new Material();
sphereMaterial2.Diffuse = new Vector4(0, 0, 0.5f, 1);
sphereMaterial2.Specular = Color.Blue.ToVector4();
sphereMaterial2.SpecularPower = 10;
Material sphereMaterial3 = new Material();
sphereMaterial3.Diffuse = new Vector4(0.5f, 0, 0, 1);
sphereMaterial3.Specular = Color.Red.ToVector4();
sphereMaterial3.SpecularPower = 10;
Material sphereMaterial4 = new Material();
sphereMaterial4.Diffuse = new Vector4(0.5f, 0, 0, 1);
sphereMaterial4.Specular = Color.Cyan.ToVector4();
sphereMaterial4.SpecularPower = 10;
Material sphereMaterial5 = new Material();
sphereMaterial5.Diffuse = new Vector4(0.5f, 0, 0, 1);
sphereMaterial5.Specular = Color.Magenta.ToVector4();
sphereMaterial5.SpecularPower = 10;
Material sphereMaterial6 = new Material();
sphereMaterial6.Diffuse = new Vector4(0.5f, 0, 0, 1);
sphereMaterial6.Specular = Color.Yellow.ToVector4();
sphereMaterial6.SpecularPower = 10;
Material sphereMaterial7 = new Material();
sphereMaterial7.Diffuse = new Vector4(0.5f, 0, 0, 1);
sphereMaterial7.Specular = Color.DarkGray.ToVector4();
sphereMaterial7.SpecularPower = 10;
Material sphereMaterial8 = new Material();
sphereMaterial8.Diffuse = new Vector4(0.5f, 0, 0, 1);
sphereMaterial8.Specular = Color.Orange.ToVector4();
sphereMaterial8.SpecularPower = 10;
Material sphereMaterial9 = new Material();
sphereMaterial9.Diffuse = new Vector4(0.5f, 0, 0, 1);
sphereMaterial9.Specular = Color.Purple.ToVector4();
sphereMaterial9.SpecularPower = 10;
Material sphereMaterial10 = new Material();
sphereMaterial10.Diffuse = new Vector4(0.5f, 0, 0, 1);
sphereMaterial10.Specular = Color.Pink.ToVector4();
sphereMaterial10.SpecularPower = 10;
int[] zero = new int[1];
int[] first = new int[1];
int[] two = new int[1];
int[] three = new int[1];
int[] four = new int[1];
int[] five = new int[1];
int[] six = new int[1];
int[] seven = new int[1];
int[] eight = new int[1];
int[] nine = new int[1];
int[] ten = new int[1];
int[] eleven = new int[1];
int[] twelve = new int[1];
int[] thirteen = new int[1];
int[] fourteen = new int[1];
int[] fifteen = new int[1];
int[] sixteen = new int[1];
int[] seventeen = new int[1];
int[] eighteen = new int[1];
int[] nineteen = new int[1];
int[] twenty = new int[1];
int[] twentyone = new int[1];
int[] twentytwo = new int[1];
int[] twentythree = new int[1];
int[] twentyfour = new int[1];
int[] twentyfive = new int[1];
int[] twentysix = new int[1];
int[] twentyseven = new int[1];
int[] twentyeight = new int[1];
int[] twentynine = new int[1];
int[] thirty = new int[1];
int[] thirtyone = new int[1];
int[] thirtytwo = new int[1];
int[] thirtythree = new int[1]{133};
int[] thirtyfour = new int[1]{134};
int[] thirtyfive = new int[1]{135};
int[] thirtysix = new int[1]{136};
int[] thirtyseven = new int[1]{137};
int[] thirtyeight = new int[1] { 138 };
int[] thirtynine = new int[1] { 139 };
int[] forty = new int[1] { 140 };
int[] fortyone = new int[1] { 141 };
zero[0] = 100;
first[0] = 101;
two[0] = 102;
three[0] = 103;
four[0] = 104;
five[0] = 105;
six[0] = 106;
seven[0] = 107;
eight[0] = 108;
nine[0] = 100;
ten[0] = 110;
eleven[0] = 111;
twelve[0] = 112;
thirteen[0] = 113;
fourteen[0] = 114;
fifteen[0] = 115;
sixteen[0] = 116;
seventeen[0] = 117;
eighteen[0] = 118;
nineteen[0] = 119;
twenty[0] = 120;
twentyone[0] = 121;
twentytwo[0] = 122;
twentythree[0] = 123;
twentyfour[0] = 124;
twentyfive[0] = 125;
twentysix[0] = 126;
twentyseven[0] = 127;
twentyeight[0] = 128;
twentynine[0] = 129;
thirty[0] = 130;
thirtyone[0] = 131;
thirtytwo[0] = 132;
ModelLoader loader = new ModelLoader();
Model trapModel0 = (Model)loader.Load("", "Boxwhite");
Model trapModel1 = (Model)loader.Load("", "Boxwhite");
Model trapModel2 = (Model)loader.Load("", "Boxwhite");
Model trapModel3 = (Model)loader.Load("", "Boxwhite");
Model trapModel4 = (Model)loader.Load("", "Boxwhite");
Model trapModel5 = (Model)loader.Load("", "Boxwhite");
Model trapModel6 = (Model)loader.Load("", "Boxwhite");
Model trapModel7 = (Model)loader.Load("", "Boxwhite");
Model trapModel8 = (Model)loader.Load("", "Boxwhite");
Model trapModel9 = (Model)loader.Load("", "Boxwhite");
Model spellModel0 = (Model)loader.Load("", "MagicHat");
Model spellModel1 = (Model)loader.Load("", "MagicHat");
Model spellModel2 = (Model)loader.Load("", "MagicHat");
Model spellModel3 = (Model)loader.Load("", "MagicHat");
Model spellModel4 = (Model)loader.Load("", "MagicHat");
Model spellModel5 = (Model)loader.Load("", "MagicHat");
Model spellModel6 = (Model)loader.Load("", "MagicHat");
Model spellModel7 = (Model)loader.Load("", "MagicHat");
Model spellModel8 = (Model)loader.Load("", "MagicHat");
Model spellModel9 = (Model)loader.Load("", "MagicHat");
Model monsterModel0 = (Model)loader.Load("", "Slime");
Model monsterModel1 = (Model)loader.Load("", "Slime");
Model monsterModel2 = (Model)loader.Load("", "Slime");
Model monsterModel3 = (Model)loader.Load("", "Slime");
Model monsterModel4 = (Model)loader.Load("", "Slime");
Model monsterModel5 = (Model)loader.Load("", "Slime");
Model monsterModel6 = (Model)loader.Load("", "Slime");
Model monsterModel7 = (Model)loader.Load("", "Slime");
Model monsterModel8 = (Model)loader.Load("", "Slime");
Model monsterModel9 = (Model)loader.Load("", "Slime");
//Marker 100
cylinderMarkerNode100 = new MarkerNode(scene.MarkerTracker, "ALVARConfigFromXML100.xml", zero);
GeometryNode cylinderNode0 = new GeometryNode("Cylinder");
cylinderNode0.Model = monsterModel0;
((Model)cylinderNode0.Model).UseInternalMaterials = false;
cylinderNode0.Material = sphereMaterial;
TransformNode cylinderTransNode0 = new TransformNode();
cylinderTransNode0.Scale = new Vector3(5, 5, 5);
cylinderTransNode0.Rotation = Quaternion.CreateFromYawPitchRoll(0, 1.5f, 0);
cylinderMarkerNode100.AddChild(cylinderTransNode0);
cylinderTransNode0.AddChild(cylinderNode0);
//add to Card array here: generic monster card here
cards[0] = new Card('M', cylinderMarkerNode100, 90, 125, "Tethys, Goddess of Light", "Attack");
//Marker 101
cylinderMarkerNode101 = new MarkerNode(scene.MarkerTracker, "ALVARConfigFromXML101.xml", first);
GeometryNode cylinderNode1 = new GeometryNode("Cylinder");
cylinderNode1.Model = monsterModel1;
((Model)cylinderNode1.Model).UseInternalMaterials = false;
cylinderNode1.Material = sphereMaterial2;
TransformNode cylinderTransNode1 = new TransformNode();
cylinderTransNode1.Scale = new Vector3(5, 5, 5);
cylinderTransNode1.Rotation = Quaternion.CreateFromYawPitchRoll(0, 1.5f, 0);
cylinderMarkerNode101.AddChild(cylinderTransNode1);
cylinderTransNode1.AddChild(cylinderNode1);
//add to Card array here: generic monster card here
cards[1] = new Card('M', cylinderMarkerNode101, 120, 150, "Athena", "Attack");
//Marker 102
cylinderMarkerNode102 = new MarkerNode(scene.MarkerTracker, "ALVARConfigFromXML102.xml", two);
GeometryNode cylinderNode2 = new GeometryNode("Cylinder");
cylinderNode2.Model = monsterModel2;
((Model)cylinderNode2.Model).UseInternalMaterials = false;
cylinderNode2.Material = sphereMaterial3;
TransformNode cylinderTransNode2 = new TransformNode();
cylinderTransNode2.Scale = new Vector3(5, 5, 5);
cylinderTransNode2.Rotation = Quaternion.CreateFromYawPitchRoll(0, 1.5f, 0);
cylinderMarkerNode102.AddChild(cylinderTransNode2);
cylinderTransNode2.AddChild(cylinderNode2);
//add to Card array here: generic monster card here
cards[2] = new Card('M', cylinderMarkerNode102, 105, 120, "Victoria", "Attack");
//Marker 103
cylinderMarkerNode103 = new MarkerNode(scene.MarkerTracker, "ALVARConfigFromXML103.xml", three);
GeometryNode cylinderNode3 = new GeometryNode("Cylinder");
cylinderNode3.Model = monsterModel3;
((Model)cylinderNode3.Model).UseInternalMaterials = false;
cylinderNode3.Material = sphereMaterial4;
TransformNode cylinderTransNode3 = new TransformNode();
cylinderTransNode3.Scale = new Vector3(5, 5, 5);
cylinderTransNode3.Rotation = Quaternion.CreateFromYawPitchRoll(0, 1.5f, 0);
cylinderMarkerNode103.AddChild(cylinderTransNode3);
cylinderTransNode3.AddChild(cylinderNode3);
//add to Card array here: generic monster card here
cards[3] = new Card('M', cylinderMarkerNode103, 130, 160, "The Agent of Force - Mars", "Attack");
//Marker 104
cylinderMarkerNode104 = new MarkerNode(scene.MarkerTracker, "ALVARConfigFromXML104.xml", four);
GeometryNode cylinderNode4 = new GeometryNode("Cylinder");
cylinderNode4.Model = monsterModel4;
((Model)cylinderNode4.Model).UseInternalMaterials = false;
cylinderNode4.Material = sphereMaterial5;
TransformNode cylinderTransNode4 = new TransformNode();
cylinderTransNode4.Scale = new Vector3(5, 5, 5);
cylinderTransNode4.Rotation = Quaternion.CreateFromYawPitchRoll(0, 1.5f, 0);
cylinderMarkerNode104.AddChild(cylinderTransNode4);
cylinderTransNode4.AddChild(cylinderNode4);
//add to Card array here: generic monster card here
cards[4] = new Card('M', cylinderMarkerNode104, 115, 155, "The Agent of Wisdom - Mercury", "Attack");
//Marker 105
cylinderMarkerNode105 = new MarkerNode(scene.MarkerTracker, "ALVARConfigFromXML105.xml", five);
GeometryNode cylinderNode5 = new GeometryNode("Cylinder");
cylinderNode5.Model = monsterModel5;
((Model)cylinderNode5.Model).UseInternalMaterials = false;
cylinderNode5.Material = sphereMaterial6;
TransformNode cylinderTransNode5 = new TransformNode();
cylinderTransNode5.Scale = new Vector3(5, 5, 5);
cylinderTransNode5.Rotation = Quaternion.CreateFromYawPitchRoll(0, 1.5f, 0);
cylinderMarkerNode105.AddChild(cylinderTransNode5);
cylinderTransNode5.AddChild(cylinderNode5);
//add to Card array here: generic monster card here
cards[5] = new Card('M', cylinderMarkerNode105, 95, 145, "The Agent of Mystery - Earth", "Attack");
//Marker 106
cylinderMarkerNode106 = new MarkerNode(scene.MarkerTracker, "ALVARConfigFromXML106.xml", six);
GeometryNode cylinderNode6 = new GeometryNode("Cylinder");
cylinderNode6.Model = monsterModel6;
((Model)cylinderNode6.Model).UseInternalMaterials = false;
cylinderNode6.Material = sphereMaterial7;
TransformNode cylinderTransNode6 = new TransformNode();
cylinderTransNode6.Scale = new Vector3(5, 5, 5);
cylinderTransNode6.Rotation = Quaternion.CreateFromYawPitchRoll(0, 1.5f, 0);
cylinderMarkerNode106.AddChild(cylinderTransNode6);
cylinderTransNode6.AddChild(cylinderNode6);
//add to Card array here: generic monster card here
cards[6] = new Card('M', cylinderMarkerNode106, 130, 175, "The Agent of Miracles - Jupiter", "Attack");
//Marker 107
cylinderMarkerNode107 = new MarkerNode(scene.MarkerTracker, "ALVARConfigFromXML107.xml", seven);
GeometryNode cylinderNode7 = new GeometryNode("Cylinder");
cylinderNode7.Model = monsterModel7;
((Model)cylinderNode7.Model).UseInternalMaterials = false;
cylinderNode7.Material = sphereMaterial8;
TransformNode cylinderTransNode7 = new TransformNode();
cylinderTransNode7.Scale = new Vector3(5, 5, 5);
cylinderTransNode7.Rotation = Quaternion.CreateFromYawPitchRoll(0, 1.5f, 0);
cylinderMarkerNode107.AddChild(cylinderTransNode7);
cylinderTransNode7.AddChild(cylinderNode7);
//add to Card array here: generic monster card here
cards[7] = new Card('M', cylinderMarkerNode107, 80, 120, "The Agent of Judgment - Saturn", "Attack");
//Marker 108
cylinderMarkerNode108 = new MarkerNode(scene.MarkerTracker, "ALVARConfigFromXML108.xml", eight);
GeometryNode cylinderNode8 = new GeometryNode("Cylinder");
cylinderNode8.Model = monsterModel8;
((Model)cylinderNode8.Model).UseInternalMaterials = false;
cylinderNode8.Material = sphereMaterial9;
TransformNode cylinderTransNode8 = new TransformNode();
cylinderTransNode8.Scale = new Vector3(5, 5, 5);
cylinderTransNode8.Rotation = Quaternion.CreateFromYawPitchRoll(0, 1.5f, 0);
cylinderMarkerNode108.AddChild(cylinderTransNode8);
cylinderTransNode8.AddChild(cylinderNode8);
//add to Card array here: generic monster card here
cards[8] = new Card('M', cylinderMarkerNode108, 75, 140, "The Agent of Creation - Venus", "Attack");
//Marker 109
cylinderMarkerNode109 = new MarkerNode(scene.MarkerTracker, "ALVARConfigFromXML109.xml", nine);
GeometryNode cylinderNode9 = new GeometryNode("Cylinder");
cylinderNode9.Model = monsterModel9;
((Model)cylinderNode9.Model).UseInternalMaterials = false;
cylinderNode9.Material = sphereMaterial10;
TransformNode cylinderTransNode9 = new TransformNode();
cylinderTransNode9.Scale = new Vector3(5, 5, 5);
cylinderTransNode9.Rotation = Quaternion.CreateFromYawPitchRoll(0, 1.5f, 0);
cylinderMarkerNode109.AddChild(cylinderTransNode9);
cylinderTransNode9.AddChild(cylinderNode9);
//add to Card array here: generic monster card here
cards[9] = new Card('M', cylinderMarkerNode109, 150, 200, "Master Hyperion", "Attack");
//Marker 110
cylinderMarkerNode110 = new MarkerNode(scene.MarkerTracker, "ALVARConfigFromXML110.xml", ten);
GeometryNode cylinderNode10 = new GeometryNode("Cylinder");
cylinderNode10.Model = spellModel0;
((Model)cylinderNode10.Model).UseInternalMaterials = false;
cylinderNode10.Material = sphereMaterial;
TransformNode cylinderTransNode10 = new TransformNode();
cylinderTransNode10.Scale = new Vector3(5, 5, 5);
cylinderTransNode10.Rotation = Quaternion.CreateFromYawPitchRoll(0, 1.5f, 0);
cylinderMarkerNode110.AddChild(cylinderTransNode10);
cylinderTransNode10.AddChild(cylinderNode10);
//add to Card array here: generic spell card here
cards[10] = new Card('S', cylinderMarkerNode110, 100, 100, "Cards from the Sky", "All of your monsters are healed for 100 hp.");
//Marker 111
cylinderMarkerNode111 = new MarkerNode(scene.MarkerTracker, "ALVARConfigFromXML111.xml", eleven);
GeometryNode cylinderNode11 = new GeometryNode("Cylinder");
cylinderNode11.Model = spellModel1;
((Model)cylinderNode11.Model).UseInternalMaterials = false;
cylinderNode11.Material = sphereMaterial2;
TransformNode cylinderTransNode11 = new TransformNode();
cylinderTransNode11.Scale = new Vector3(5, 5, 5);
cylinderTransNode11.Rotation = Quaternion.CreateFromYawPitchRoll(0, 1.5f, 0);
cylinderMarkerNode111.AddChild(cylinderTransNode11);
cylinderTransNode11.AddChild(cylinderNode11);
//add to Card array here: generic spell card here
cards[11] = new Card('S', cylinderMarkerNode111, 100, 100, "Valhalla, Hall of the Fallen", "All of your monsters are completly healed.");
//Marker 112
cylinderMarkerNode112 = new MarkerNode(scene.MarkerTracker, "ALVARConfigFromXML112.xml", twelve);
GeometryNode cylinderNode12 = new GeometryNode("Cylinder");
cylinderNode12.Model = spellModel2;
((Model)cylinderNode12.Model).UseInternalMaterials = false;
cylinderNode12.Material = sphereMaterial3;
TransformNode cylinderTransNode12 = new TransformNode();
cylinderTransNode12.Scale = new Vector3(5, 5, 5);
cylinderTransNode12.Rotation = Quaternion.CreateFromYawPitchRoll(0, 1.5f, 0);
cylinderMarkerNode112.AddChild(cylinderTransNode12);
cylinderTransNode12.AddChild(cylinderNode12);
//add to Card array here: generic spell card here
cards[12] = new Card('S', cylinderMarkerNode112, 100, 100, "Terraforming", "All of your monsters are healed for 1 hp.");
//Marker 113
cylinderMarkerNode113 = new MarkerNode(scene.MarkerTracker, "ALVARConfigFromXML113.xml", thirteen);
GeometryNode cylinderNode13 = new GeometryNode("Cylinder");
cylinderNode13.Model = spellModel3;
((Model)cylinderNode13.Model).UseInternalMaterials = false;
cylinderNode13.Material = sphereMaterial4;
TransformNode cylinderTransNode13 = new TransformNode();
cylinderTransNode13.Scale = new Vector3(5, 5, 5);
cylinderTransNode13.Rotation = Quaternion.CreateFromYawPitchRoll(0, 1.5f, 0);
cylinderMarkerNode113.AddChild(cylinderTransNode13);
cylinderTransNode13.AddChild(cylinderNode13);
//add to Card array here: generic spell card here
cards[13] = new Card('S', cylinderMarkerNode113, 100, 100, "Smashing Ground", "All of your monsters are healed for 20 hp.");
//Marker 114
cylinderMarkerNode114 = new MarkerNode(scene.MarkerTracker, "ALVARConfigFromXML114.xml", fourteen);
GeometryNode cylinderNode14 = new GeometryNode("Cylinder");
cylinderNode14.Model = spellModel4;
((Model)cylinderNode14.Model).UseInternalMaterials = false;
cylinderNode14.Material = sphereMaterial5;
TransformNode cylinderTransNode14 = new TransformNode();