Example #1
0
 protected virtual void OnViewChanged(object sender, Viking.Common.ViewChangeEventArgs e)
 {
     if(this.GetType().ToString() == e.TypeString)
     {
         this.Visible = e.Visible;
     }
 }
        public LinkStructureToParentCommand(Viking.UI.Controls.SectionViewerControl parent,
                                               Structure structure, 
                                               Location_CanvasViewModel location)
            : base(parent)
        {
            this.putativeStruct = structure;
            this.putativeLoc = location;

            StructureType LocType = this.putativeStruct.Type;
            if (LocType != null)
            {
                linecolor = new Microsoft.Xna.Framework.Color(LocType.Color.R,
                    LocType.Color.G,
                    LocType.Color.B,
                    128);
            }
            else
            {
                linecolor = Microsoft.Xna.Framework.Color.Green;
            }

            //Transform the location position to the correct coordinates
            transformedPos = parent.SectionToVolume(new GridVector2(putativeLoc.X, putativeLoc.Y));

            parent.Cursor = Cursors.Cross;
        }
        public void _3_RandomTests()
        {
            for (int n = 0; n < 10; n++)
            {
                IUnit viking   = new Viking();
                int   position = viking.Position;

                for (int i = 0; i < 10; i++)
                {
                    if (random.NextDouble() <= 0.5)
                    {
                        viking.MoveBehavior = new Fly();
                        position           += 10;
                    }
                    else
                    {
                        viking.MoveBehavior = new Walk();
                        position           += 1;
                    }
                    viking.Move();
                }

                Assert.AreEqual(position, viking.Position);
            }
        }
Example #4
0
        private static void Main(string[] args)
        {
            var vikings = new Viking[]
            {
                new Viking("Викинг 1"),
                new Viking("Викинг 2"),
                new Viking("Викинг 3")
            };

            Carrier carrier = new BattleCruiser(vikings);

            carrier.Intercept();
            carrier.Shoot();

            var tieFighters = new TieFighter[]
            {
                new TieFighter("TIE fighter 1"),
                new TieFighter("TIE fighter 2"),
                new TieFighter("TIE fighter 3")
            };

            carrier = new ImperialDestroyer(tieFighters);
            carrier.Intercept();
            carrier.Shoot();
        }
Example #5
0
        private void OnTriggerExit(Collider other)
        {
            if (other.attachedRigidbody == null)
            {
                return;
            }

            Viking viking = other.attachedRigidbody.GetComponent <Viking>();

            if (viking == null)
            {
                return;
            }

            if (vikingsInRange.ContainsKey(viking))
            {
                int value = --vikingsInRange[viking];
                if (value <= 0)
                {
                    vikingsInRange.Remove(viking);

                    if (isPlaying)
                    {
                        viking.CancelAffect(usingPlayer, this);
                    }
                }
            }
            else
            {
                Debug.LogWarning("Unbalanced enter/exits", this);
            }
        }
Example #6
0
        public void DrawLabels(Viking.UI.Controls.SectionViewerControl _Parent)
        {
            float Scale = (float)(1.0f / _Parent.StatusMagnification) * 10;

            _Parent.spriteBatch.Begin();

            for (int i = 0; i < MapPoints.Length; i++ )
            {
                GridVector2 ControlPositionScreen = _Parent.WorldToScreen(this.MapPoints[i].ControlPoint.X, this.MapPoints[i].ControlPoint.Y);
                GridVector2 MappedPositionScreen = _Parent.WorldToScreen(this.MapPoints[i].MappedPoint.X, this.MapPoints[i].MappedPoint.Y);

                Vector2 Offset = _Parent.GetLabelSize(_Parent.fontArial, i.ToString());
                Offset.X /= 2f;
                Offset.Y /= 2f;

                _Parent.spriteBatch.DrawString(_Parent.fontArial,
                                        i.ToString(),
                                        new Vector2((float)ControlPositionScreen.X, (float)ControlPositionScreen.Y),
                                        ControlColor,
                                        0,
                                        Offset,
                                        Scale,
                                        SpriteEffects.None,
                                        0);

                _Parent.spriteBatch.DrawString(_Parent.fontArial,
                                       i.ToString(),
                                       new Vector2((float)MappedPositionScreen.X, (float)MappedPositionScreen.Y),
                                       MappedColor,
                                       0,
                                       Offset,
                                       Scale,
                                       SpriteEffects.None,
                                       0);
            }

            _Parent.spriteBatch.DrawString(_Parent.fontArial,
                                        "Control Points",
                                        new Vector2((float)15, (float)15),
                                        ControlColor,
                                        0,
                                        new Vector2(),
                                        .2f,
                                        SpriteEffects.None,
                                        0);

            Vector2 LegendSize = _Parent.GetLabelSize(_Parent.fontArial,  "Control Points");

            _Parent.spriteBatch.DrawString(_Parent.fontArial,
                                   "Mapped Points",
                                   new Vector2((float)15, (float) 3 + 15 + LegendSize.Y),
                                   MappedColor,
                                   0,
                                   new Vector2(),
                                   .2f,
                                   SpriteEffects.None,
                                   0);

            _Parent.spriteBatch.End();
        }
Example #7
0
        public LocationLinksViewModel(Viking.UI.Controls.SectionViewerControl Parent)
        {
            this.parent = Parent;

            NotifyCollectionChangedEventManager.AddListener(Store.LocationLinks, this);
            NotifyCollectionChangedEventManager.AddListener(Store.Locations, this);
        }
Example #8
0
        private void AddEventListeners()
        {
            VikingController.Instance.VikingSpawned += vik => {
                viking                  = vik;
                viking.LeaveQueue      += OnVikingLeaveQueue;
                viking.TakingSeat      += OnVikingTakeSeat;
                viking.BecameSatisfied += OnVikingSatisfied;
                viking.SatisfiedEnd    += OnVikingSatisfiedEnd;
                viking.Hit             += OnVikingHit;
                viking.OrderTaken      += OnVikingOrderTaken;
            };

            tankard.OnPickedUp += OnTankardPickedUp;
            tankard.OnSpilled  += OnTankardSpilled;

            beerTap.BeerPoured  += OnBeerPoured;
            beerTap.TapRefilled += OnBeerTapRefilled;

            beerCellar.beerBarrelSpawn += barrel => barrel.OnPickedUp += OnBeerBarrelPickedUp;

            kitchen.CookingFinished += OnCookingFinished;

            GoblinController.Instance.GoblinSpawned += OnGoblinSpawned;

            table.Destroyed += OnTableDestroyed;
            table.Repaired  += OnTableRepaired;

            instrument.OnPickedUp += OnInstrumentPickedUp;
            instrument.OnDropped  += OnInstrumentDropped;
            weapon.OnPickedUp     += OnWeaponPickedUp;
            tool.OnPickedUp       += OnToolPickedUp;

            Tavern.Instance.OnMoneyChanges += OnMoneyChanged;
        }
Example #9
0
        public Command(Viking.UI.Controls.SectionViewerControl parent)
        {
            this.Parent = parent;

            MyMouseClick = new MouseEventHandler(this.OnMouseClick);
            MyMouseDoubleClick = new MouseEventHandler(this.OnMouseDoubleClick);
            MyMouseDown = new MouseEventHandler(this.OnMouseDown);
            MyMouseUp = new MouseEventHandler(this.OnMouseUp);
            MyMouseWheel = new MouseEventHandler(this.OnMouseWheel);
            MyMouseMove = new MouseEventHandler(this.OnMouseMove);

            MyMouseHover = new EventHandler(this.OnMouseHover);
            MyMouseLeave = new EventHandler(this.OnMouseLeave);
            MyMouseEnter = new EventHandler(this.OnMouseEnter);

            MyKeyPress  = new KeyPressEventHandler(this.OnKeyPress);

            MyKeyDown = new KeyEventHandler(this.OnKeyDown);

            Parent.MouseClick += MyMouseClick;
            Parent.MouseDoubleClick += MyMouseDoubleClick;
            Parent.MouseDown += MyMouseDown;
            Parent.MouseUp += MyMouseUp;
            Parent.MouseWheel += MyMouseWheel;
            Parent.MouseMove += MyMouseMove;
            Parent.MouseHover += MyMouseHover;
            Parent.MouseLeave += MyMouseLeave;
            Parent.MouseEnter += MyMouseEnter;
            Parent.KeyPress += MyKeyPress;
            Parent.KeyDown += MyKeyDown;
        }
 public CreateNewStructureCommand(Viking.UI.Controls.SectionViewerControl parent, 
                                        Structure structure, 
                                        Location_CanvasViewModel location)
     : base(parent)
 {
     this.newStruct = structure;
     this.newLoc = location;
 }
Example #11
0
 private void HealthCheck(Viking viking, int currentHealth, int maxHealth)
 {
     if (viking == currentViking && currentHealth <= 0)
     {
         Debug.Log("Current health is " + currentHealth + ", so calling game over");
         StartCoroutine(GameOver());
     }
 }
Example #12
0
 // called by viking button
 public void SwitchVikings(int i)
 {
     currentViking.enabled = false;
     currentViking         = vikingManager.GetViking(i).GetComponent <Viking>();
     currentViking.GetComponent <Rigidbody2D>().simulated = true;
     currentViking.enabled = true;
     backgrounds[backgrounds.Count - 1].GetComponentInChildren <Cinemachine.CinemachineVirtualCamera>().Follow = currentViking.transform;
 }
 public CreateNewLinkedLocationCommand(Viking.UI.Controls.SectionViewerControl parent,
                                        Location_CanvasViewModel existingLoc,
                                        Location_CanvasViewModel newLoc)
     : base(parent)
 {
     this.NewLoc = newLoc;
     this.ExistingLoc = existingLoc;
 }
        // GET: Viking/Create
        public ActionResult Create()
        {
            ViewBag.ListeTypesViking = getListeTypesViking(string.Empty);

            Viking viking = new Viking();

            FillSelect(viking);
            return(View(viking));
        }
Example #15
0
        public override void Update(ref Viking entity)
        {
            base.Update(ref entity);

            //Mise à jour du core SolR
            VikingsIndexer vikingIndexer = new VikingsIndexer(this.dbContext);

            vikingIndexer.Add(entity);
        }
Example #16
0
        public void OnVikingTakeChair(Viking viking)
        {
            if (SittingViking != null)
            {
                Debug.LogError("A viking is attempting to take an already taken chair", this);
            }

            SittingViking = viking;
        }
Example #17
0
        public override void Delete(ref Viking entity)
        {
            //Mise à jour du core SolR
            VikingsIndexer vikingIndexer = new VikingsIndexer(this.dbContext);

            vikingIndexer.delete(entity);

            base.Delete(ref entity);
        }
Example #18
0
        public void _0_WalkMove()
        {
            IUnit viking = new Viking();

            viking.Move();
            Assert.AreEqual(1, viking.Position);
            viking.Move();
            Assert.AreEqual(2, viking.Position);
        }
Example #19
0
 // Constructor
 public People()
 {
     slaves             = new Slaves();
     shieldMaidens      = new ShieldMaiden();
     vikings            = new Viking();
     nbrOfSlave         = 5;
     nbrOfVikings       = 20;
     nbrOfShieldMaidens = 10;
 }
Example #20
0
 // Constructor
 public People()
 {
     slaves             = new Slaves();
     shieldMaidens      = new ShieldMaiden();
     vikings            = new Viking();
     nbrOfSlave         = 5;
     nbrOfVikings       = 20;
     nbrOfShieldMaidens = 10;
     nbrTotalOfWarriors = nbrOfVikings + nbrOfShieldMaidens;
 }
Example #21
0
        public void OnVikingLeaveChair(Viking viking)
        {
            if (viking != SittingViking)
            {
                Debug.LogError("The viking leaving a chair is not the same as the one sitting", this);
                return;
            }

            SittingViking = null;
        }
Example #22
0
        public void BeginSeatingViking(Viking viking)
        {
            if (Follower != null)
            {
                Debug.Assert(false, "Player does not have a follower");
                return;
            }

            Follower = viking;
        }
Example #23
0
        public async Task <IHttpActionResult> GetVikingByID(int id)
        {
            Viking viking = await _ctx.Vikings.FindAsync(id);

            if (viking != null)
            {
                return(Ok(viking));
            }
            return(NotFound());
        }
Example #24
0
        public void EndSeatingViking(Viking viking)
        {
            if (viking != Follower)
            {
                Debug.Assert(false, "Viking is the follower");
                return;
            }

            Follower = null;
        }
Example #25
0
    private void ChangeHealth(Viking viking, int currentHealth, int maxHealth)
    {
        if (viking == GameManager.Instance.CurrentViking)
        {
            healthSlider.maxValue = maxHealth;
            healthSlider.value    = currentHealth;
        }

        //healthText.text = $"{currentHealth}/{maxHealth}";
    }
Example #26
0
        public virtual VikingState HandleOnHit(Axe axe, Viking viking)
        {
            viking.Stats.TakeMoodDamage(axe.WeaponData.moodDamage);

            if (viking.Stats.Mood <= viking.Data.brawlMoodThreshold)
            {
                return(new BrawlingVikingState(viking, axe.GetComponentInParent <Player.PlayerComponent>()));
            }
            return(this);
        }
Example #27
0
    private void ChangeStamina(Viking viking, int currentStamina, int maxStamina)
    {
        if (viking == GameManager.Instance.CurrentViking)
        {
            staminaSlider.maxValue = maxStamina;
            staminaSlider.value    = currentStamina;
        }

        //staminaText.text = $"{currentStamina}/{maxStamina}";
    }
Example #28
0
        public void _2_MixMove()
        {
            IUnit viking = new Viking();

            viking.Move();
            Assert.AreEqual(1, viking.Position);

            viking.MoveBehavior = new Fly();
            viking.Move();
            Assert.AreEqual(11, viking.Position);
        }
Example #29
0
        public async Task <IHttpActionResult> PostViking(Viking model)
        {
            if (ModelState.IsValid)
            {
                _ctx.Vikings.Add(model);
                await _ctx.SaveChangesAsync();

                return(Ok());
            }
            return(BadRequest(ModelState));
        }
Example #30
0
        public void MixMove()
        {
            IUnit viking = new Viking();

            viking.StartMoving();
            Assert.AreEqual(1, viking.Position);

            viking.SetMoveBehavior(new Fly());
            viking.StartMoving();
            Assert.AreEqual(11, viking.Position);
        }
Example #31
0
        public CreateBookmarkCommand(Viking.UI.Controls.SectionViewerControl parent, FolderUIObj parentFolder)
            : base(parent)
        {
            //Make the cursor something distinct and appropriate for measuring
            parent.Cursor = Cursors.Cross;
            //Cursor.Hide();

            ParentFolder = parentFolder;

            this.CommandActive = true;
        }
        public SectionAnnotationViewModel(SectionViewModel section,  Viking.UI.Controls.SectionViewerControl Parent)
        {
            this.parent = Parent;
            this.Section = section;

            Store.Locations.OnAddUpdateRemoveKey += new AddUpdateRemoveKeyEventHandler(OnStoreAddRemoveKey);
            Store.Locations.OnAllUpdatesCompleted += new OnAllUpdatesCompletedEventHandler(OnAllUpdatesCompleted);

            LocationLinkDeletedEventHandler = new EventHandler(OnLocationLinkDeleted);
            StructureLinkDeletedEventHandler = new EventHandler(OnStructureLinkDeleted);
        }
        private void FillSelect(Viking viking)
        {
            TypeVikingFactory typeVikingFactory = new TypeVikingFactory(db);

            ViewBag.ID_TYPE = new SelectList(typeVikingFactory.GetAll(), "Id", "TypeVikingId", viking.TypeViking);

            //Chargement d'une liste vide à la création
            TypeVikingFactory sousTypeFactory = new TypeVikingFactory(db);

            ViewBag.ID_SOUS_TYPE = new SelectList(sousTypeFactory.getManyBy(viking.TypeVikingId).OrderBy(i => i.Value), "Key", "Value", viking.TypeViking);
        }
Example #34
0
        public void _1_FlyMove()
        {
            IUnit viking = new Viking();

            viking.MoveBehavior = new Fly();

            viking.Move();
            Assert.AreEqual(10, viking.Position);
            viking.Move();
            Assert.AreEqual(20, viking.Position);
        }
Example #35
0
        public void SwordsmanVsViking()
        {
            Warrior swordsman = new Swordsman();

            Viking viking = new Viking();

            swordsman.Engage(viking);

            Assert.AreEqual(0, swordsman.HitPoints());
            Assert.AreEqual(35, viking.HitPoints());
        }
        public ActionResult DeleteConfirmed(int id)
        {
            VikingFactory vikingsFactory = new VikingFactory(db);
            Viking        viking         = vikingsFactory.GetById(id);

            vikingsFactory.Delete(ref viking);

            // Ajout d'un message flash
            this.Success("Viking supprimé avec succès.");

            return(RedirectToAction("Index"));
        }
Example #37
0
        public void SwordsmanWithBucklerVsVikingWithBuckler()
        {
            Swordsman swordsman = new Swordsman()
                                  .Equip("buckler");

            Viking viking = new Viking()
                            .Equip("buckler");

            swordsman.Engage(viking);

            Assert.AreEqual(0, swordsman.HitPoints());
            Assert.AreEqual(70, viking.HitPoints());
        }
Example #38
0
    public void Initialise(string axeID, Viking player, IController controller)
    {
        name        = axeID;
        this.player = player;
        rb2d        = GetComponent <Rigidbody2D>();

        float   projectileX     = player.GetChief().GetComponent <Chief>().GetPrevious().x;
        float   projectileY     = player.GetChief().GetComponent <Chief>().GetPrevious().y;
        Vector2 projectileThrow = new Vector2(projectileX, projectileY);

        projectileThrow += new Vector2(controller.MoveHorizontal(), controller.MoveVertical()) / 3 * 2;
        projectileThrow += new Vector2(randomSpread * 2 * (Random.value - 0.5f), randomSpread * 2 * (Random.value - 0.5f));
        rb2d.AddForce(projectileThrow * 1000);
    }
Example #39
0
 private void Attack()
 {
     animator.SetTrigger("Melee");
     Collider2D[] hits = Physics2D.OverlapCircleAll(attackPoint.position, 0.4f);
     foreach (Collider2D hit in hits)
     {
         Viking viking = hit.GetComponent <Viking>();
         // if (viking != null)
         if (viking == GameManager.Instance.CurrentViking)
         {
             viking.TakeDamage(stats.damage, stats.element);
             Instantiate(impactEffect, attackPoint.position, Quaternion.identity);
         }
     }
 }
Example #40
0
        public ResizeLocationCommand(Viking.UI.Controls.SectionViewerControl parent)
            : base(parent)
        {
            selected = Viking.UI.State.SelectedObject as Location_CanvasViewModel;
            Debug.Assert(selected != null);

            LocType = selected.Parent.Type;

            SectionLocationsViewModel sectionAnnotations = AnnotationOverlay.GetAnnotationsForSection(Parent.Section.Number);
            if (sectionAnnotations == null)
                return;

            Origin = sectionAnnotations.GetPositionForLocation(selected);
            parent.Cursor = Cursors.SizeAll;
            SaveToDB = true;
        }
Example #41
0
        public ResizeLocationCommand(Viking.UI.Controls.SectionViewerControl parent, 
                                     StructureType type, 
                                     Location_CanvasViewModel loc)
            : base(parent)
        {
            selected = loc;
            LocType = type;
            this.SaveToDB = false;

            SectionLocationsViewModel sectionAnnotations = AnnotationOverlay.GetAnnotationsForSection(Parent.Section.Number);
            if (sectionAnnotations == null)
                return;

            //Origin = sectionAnnotations.GetPositionForLocation(selected);
            Origin = selected.VolumePosition;
            parent.Cursor = Cursors.SizeAll;
             //           CreationTime = DateTime.Now;
        }
        public SectionLocationsViewModel(SectionViewModel section,  Viking.UI.Controls.SectionViewerControl Parent)
        {
            this.parent = Parent;
            Trace.WriteLine("Create SectionLocationsViewModel for " + section.Number.ToString());
            this.Section = section;

            GridRectangle bounds = AnnotationOverlay.SectionBounds(parent, parent.Section.Number);

            if (Locations == null)
                Locations = new QuadTree<Location_CanvasViewModel>(bounds);

            LocationsForStructure = new ConcurrentDictionary<long, ConcurrentDictionary<long, Location_CanvasViewModel>>();
            
            StructureLinksSearch = new LineSearchGrid<StructureLink>(bounds, 10000);
            
            CollectionChangedEventManager.AddListener(Store.Structures, this);
            CollectionChangedEventManager.AddListener(Store.StructureLinks, this);
        }
Example #43
0
        public LocationObjCommand(Viking.UI.Controls.SectionViewerControl parent)
            : base(parent)
        {
            selected = Viking.UI.State.SelectedObject as Location_CanvasViewModel;
            Debug.Assert(selected != null);

            if (selected.Parent != null)
            {
                LocType = selected.Parent.Type;
            }

            //Figure out if we've selected a location on the same section or different
            if (selected.Section != this.Parent.Section.Number)
            {
                parent.Cursor = Cursors.Cross;
            }
            else
            {
                parent.Cursor = Cursors.Hand;
            }
        }
Example #44
0
 public ScreenCaptureCommand(Viking.UI.Controls.SectionViewerControl parent)
     : base(parent)
 {
     parent.Cursor = Cursors.Cross;
 }
Example #45
0
        public void SetParent(Viking.UI.Controls.SectionViewerControl parent)
        {
            //I'm only expecting this to be set once
            Debug.Assert(_Parent == null, "Not expecting parent to be set twice, OK to ignore, but annotation display may be incorrect");
            this._Parent = parent;

            //Load the locations for the current sections
            this._Parent.OnSectionChanged += new SectionChangedEventHandler(this.OnSectionChanged);
            this._Parent.OnSectionTransformChanged += new TransformChangedEventHandler(this.OnSectionTransformChanged);
            this._Parent.OnVolumeTransformChanged += new TransformChangedEventHandler(this.OnVolumeTransformChanged);
            this._Parent.OnReferenceSectionChanged += new EventHandler(this.OnReferenceSectionChanged);

            this._Parent.MouseDown += new MouseEventHandler(this.OnMouseDown);
            this._Parent.MouseMove += new MouseEventHandler(this.OnMouseMove);
            this._Parent.MouseUp += new MouseEventHandler(this.OnMouseUp);
            this._Parent.KeyDown += new KeyEventHandler(this.OnKeyDown);
            this._Parent.KeyUp += new KeyEventHandler(this.OnKeyUp);

               // AnnotationCache.parent = parent;
            GlobalPrimitives.CircleTexture = parent.LoadTextureWithAlpha("Circle", "CircleMask"); //parent.Content.Load<Texture2D>("Circle");
            GlobalPrimitives.UpArrowTexture = parent.LoadTextureWithAlpha("UpArrowV2", "UpArrowMask"); //parent.Content.Load<Texture2D>("Circle");

            linksView = new LocationLinksViewModel(parent);

            LoadSectionAnnotations();
        }
Example #46
0
        /// <summary>
        /// Allocates a new quad tree based on the current section parameters
        /// </summary>
        public static GridRectangle SectionBounds(Viking.UI.Controls.SectionViewerControl Parent, int SectionNumber)
        {
            GridRectangle bounds = new GridRectangle();

            //Figure out the new boundaries for our quad-tree
            if(!Parent.Section.VolumeViewModel.SectionViewModels.ContainsKey(SectionNumber))
                return new GridRectangle();

            SectionViewModel SectionView = Parent.Section.VolumeViewModel.SectionViewModels[SectionNumber];
            bounds = Parent.SectionBounds(SectionView.section);
            if (SectionView.ReferenceSectionAbove != null)
            {
                bounds = GridRectangle.Union(bounds, Parent.SectionBounds(SectionView.ReferenceSectionAbove));
            }
            if (SectionView.ReferenceSectionBelow != null)
            {
                bounds = GridRectangle.Union(bounds, Parent.SectionBounds(SectionView.ReferenceSectionBelow));
            }

            return bounds;
        }
Example #47
0
 public DefaultCommand(Viking.UI.Controls.SectionViewerControl parent)
     : base(parent)
 {
 }
Example #48
0
 public PlaceStructureCommand(Viking.UI.Controls.SectionViewerControl parent, StructureType type)
     : base(parent)
 {
     this.Type = type;
     parent.Cursor = Cursors.Cross;
 }
Example #49
0
        public void RemoveObject(Viking.Common.IUIObject Object)
        {
            Debug.Assert(Object != null);
            if(Object == null)
                return;

            ListViewItem Item = ItemForObject(Object);
            if(Item == null)
            {
                Debug.Write("Calling DataObjectListView::RemoveObject for object not in list");
                return;
            }

            IUIObject Obj = Item.Tag as IUIObject;
            RemoveObjectEvents(Obj);

            Item.Remove();
            Item.Tag = null;

            return;
        }
Example #50
0
 void Viking.Common.ISectionOverlayExtension.SetParent(Viking.UI.Controls.SectionViewerControl parent)
 {
     _parent = parent;
     StarTexture = parent.Content.Load<Texture2D>("Star");
 }
Example #51
0
 public CreateStructureCommand(Viking.UI.Controls.SectionViewerControl parent)
     : base(parent)
 {
     parent.Cursor = Cursors.Cross;
 }
Example #52
0
        public void DrawLabels(Viking.UI.Controls.SectionViewerControl _Parent)
        {
            float Scale = (float)(1.0f / _Parent.StatusMagnification);
            Vector2 Offset;

            _Parent.spriteBatch.Begin();

            for (int i = 0; i < this.Tile.Verticies.Length; i++)
            {
                GridVector2 ControlPositionScreen = _Parent.WorldToScreen(this.Tile.Verticies[i].Position.X, this.Tile.Verticies[i].Position.Y);

                Offset = _Parent.GetLabelSize(_Parent.fontArial, i.ToString());
                Offset.X /= 2f;
                Offset.Y /= 2f;

                _Parent.spriteBatch.DrawString(_Parent.fontArial,
                                        i.ToString(),
                                        new Vector2((float)ControlPositionScreen.X, (float)ControlPositionScreen.Y),
                                        this.TileColor,
                                        0,
                                        Offset,
                                        Scale,
                                        SpriteEffects.None,
                                        0);
            }

            if (this.Tile.Verticies.Length > 0)
            {
                double TileNameX = this.Tile.Bounds.Left + (this.Tile.Bounds.Width / 2);
                double TileNameY = this.Tile.Bounds.Bottom + (this.Tile.Bounds.Height / 2);
                GridVector2 NamePositionScreen = _Parent.WorldToScreen(TileNameX, TileNameY);
                Offset = _Parent.GetLabelSize(_Parent.fontArial, this.Tile.TextureFullPath);
                Offset.X /= 2f;
                Offset.Y /= 2f;

                _Parent.spriteBatch.DrawString(_Parent.fontArial,
                                        this.Tile.TextureFullPath.ToString(),
                                        new Vector2((float)NamePositionScreen.X, (float)NamePositionScreen.Y),
                                        this.TileColor,
                                        0,
                                        Offset,
                                        Scale,
                                        SpriteEffects.None,
                                        0);
            }

            _Parent.spriteBatch.End();
        }
Example #53
0
        /// <summary>
        /// OK, the normal state of the UI is that the default command is active.  When the current command dies we 
        /// check for two things
        /// 1) Are there any commands queued to become active when the current command is dead
        /// 2) Are there any commands registered to handle the current selected object
        /// 3) If not, we activate the default command
        /// </summary>
        /// <param name="Parent"></param>
        /// <param name="Obj"></param>
        /// <returns></returns>
        public static Command CreateFor(Viking.UI.Controls.SectionViewerControl Parent, object Obj)
        {
            Command newCommand = null;

            //Check if there is a command in the queue
            if (_CommandQueue.Count != 0)
            {
                CommandQueueEntry nextCommand = _CommandQueue.Dequeue();

                //Some commands execute in thier constructor, so check if we should return this command or the default
                newCommand =  Activator.CreateInstance(nextCommand.Command, nextCommand.Args) as Command;
                //if (true == newCommand.Deactivated)
                //    newCommand = new DefaultCommand(Parent);
                //else
            //                    return newCommand;
            }

            if (Obj != null && newCommand == null)
            {
                System.Type[] Commands = Viking.Common.ExtensionManager.GetCommandsForType(Obj.GetType());

                //TODO: Figure out how to handle multiple commands
                if (Commands.Length > 0)
                {
                    newCommand = Activator.CreateInstance(Commands[0], new object[] { Parent }) as Command;
                }
            }

            if (newCommand == null)
            {
                newCommand = new DefaultCommand(Parent);
            }

            //TODO: Make these consistent with the extension commands.
            if(newCommand != null)
                newCommand.OnActivate();

            return newCommand;
        }
Example #54
0
	public Character SpawnCharacter(CharacterData.CharacterClassType classType, int charModeType, int camp, int level, Vector3 pos, Vector3 dir, CharacterStatus.Pose pose){
		this.START_METHOD("SpawnCharacter");
		Character tempChar = null;
		//create the enemies
		if (classType == CharacterData.CharacterClassType.CHARACTER) {
			//create the enemy
			if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.BOWMAN){
				Bowman chara = new Bowman();
				chara.SetPos(pos);
				chara.SetDir(dir);
				chara.SetPose(pose);
				chara.SetCamp(camp);
				chara.SetSpeed(0.01f);
				//set bowman max life
				chara.SetLife(200);
				tempChar = chara;
			} else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.GIANT){
				Gaint chara = new Gaint();
				chara.SetPos(pos);
				chara.SetDir(dir);
				chara.SetPose(pose);
				chara.SetCamp(camp);
				chara.SetSpeed(0.01f);
				//set giant max life
				chara.SetLife(400);
				tempChar = chara;
			} else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.VIKING){
				Viking chara = new Viking();
				chara.SetPos(pos);
				chara.SetDir(dir);
				chara.SetPose(pose);
				chara.SetCamp(camp);
				chara.SetSpeed(0.01f);
				//set viking max life
				chara.SetLife(300);
				tempChar = chara;
			} 
			if(tempChar != null){
				chars.Add(tempChar);
			} else {
				throw new UnityException("no current char type to spawn!");
			}
		}
		//create the building
		else if (classType == CharacterData.CharacterClassType.BUILDING) {
			//create the barrack to gather resources
			if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.BARRACK){
				TowerBarrack character = new TowerBarrack();
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetCamp(camp);
				tempChar = character;
			} else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.CANNON){
				Cannon character = new Cannon();
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose (pose);
				character.SetCamp(camp);
				//set attack power
				character.SetAttackPower(50);
				tempChar = character;
			}
			//Tower01
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER1){
				Tower1 character = new Tower1();
				character.SetAttackRange(3);
				character.SetLevel(1);
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose (pose);
				character.SetCamp(camp);
				character.SetAttackRate(1f);
				//set attack power
				character.SetAttackPower(1);
				tempChar = character;
			}
			//Tower02
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER2){
				Tower2 character = new Tower2();
				character.SetAttackRange(3);
				character.SetLevel(1);
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose (pose);
				character.SetCamp(camp);
				character.SetAttackRate(1f);
				//set attack power
				character.SetAttackPower(1);
				tempChar = character;
			}
			//Tower4
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER4){
				Tower4 character = new Tower4();
				character.SetAttackRange(2);
				character.SetLevel(1);
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose(pose);
				character.SetCamp(camp);
				tempChar = character;
			}
			//Tower7
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER7){
				Tower7 character = new Tower7();
				character.SetAttackRange(2);
				character.SetLevel(1);
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose(pose);
				character.SetCamp(camp);
				character.SetAttackPower(1);
				character.SetAttackRate(1f);
				tempChar = character;
			}
			//Tower10
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER10){
				Tower10 character = new Tower10();
				character.SetAttackRange(4);
				character.SetLevel(1);
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose(pose);
				character.SetCamp(camp);
				character.SetAttackPower(1);
				character.SetAttackRate(2f);
				tempChar = character;
			}
			//created the barrack, add to the building list
			if(tempChar != null){
				building.Add(tempChar);
			} else { 
				throw new UnityException("no current building type to spawn!");
			}
		}
		//add to the all character list
		allCharacter.Add (tempChar);
		this.END_METHOD("SpawnCharacter");
		return tempChar;
	}
Example #55
0
	public Character SpawnCharacter(CharacterData.CharacterClassType classType, int charModeType, int camp, int level, Vector3 pos, Vector3 dir, CharacterStatus.Pose pose){
		this.START_METHOD("SpawnCharacter");
		Character tempChar = null;
		//create the enemies
		if (classType == CharacterData.CharacterClassType.CHARACTER) {
			//create the enemy
			if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.BOWMAN){
				Bowman chara = new Bowman();
				chara.SetArmor(armorList[0]);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			}
//			} else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.GIANT){
//				Gaint chara = new Gaint("giant");
//				SetEnemy(chara,pos,dir,camp,pose,0.02f,20);
//				tempChar = chara;
//			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.VIKING){
				Viking chara = new Viking();
				chara.SetArmor(armorList[1]);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,30);
				tempChar = chara;
			}
			//create enemy2
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY2){
				Gaint chara = new Gaint("enemy2");
				chara.SetArmor(armorList[2]);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			//enemy3
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY3){
				Gaint chara = new Gaint("enemy3");
				chara.SetArmor(armorList[3]);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			//enemy4
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY4){
				Gaint chara = new Gaint("enemy4");
				chara.SetArmor(armorList[4]);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY5){
				Gaint chara = new Gaint("enemy5");
				chara.SetArmor(armorList[5]);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY6){
				Gaint chara = new Gaint("enemy6");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY7){
				Gaint chara = new Gaint("enemy7");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY8){
				Gaint chara = new Gaint("enemy8");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY9){
				Gaint chara = new Gaint("enemy9");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY10){
				Gaint chara = new Gaint("enemy10");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY11){
				Gaint chara = new Gaint("enemy11");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY12){
				Gaint chara = new Gaint("enemy12");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY13){
				Gaint chara = new Gaint("enemy13");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY14){
				Gaint chara = new Gaint("enemy14");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY15){
				Gaint chara = new Gaint("enemy15");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY16){
				Gaint chara = new Gaint("enemy16");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY17){
				Gaint chara = new Gaint("enemy17");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 

			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY19){
				Gaint chara = new Gaint("enemy19");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY20){
				Gaint chara = new Gaint("enemy20");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY21){
				Gaint chara = new Gaint("enemy21");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY22){
				Gaint chara = new Gaint("enemy22");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 

			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY24){
				Gaint chara = new Gaint("enemy24");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY25){
				Gaint chara = new Gaint("enemy25");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 

			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY27){
				Gaint chara = new Gaint("enemy27");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY28){
				Gaint chara = new Gaint("enemy28");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY30){
				Gaint chara = new Gaint("enemy30");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY31){
				Gaint chara = new Gaint("enemy31");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY32){
				Gaint chara = new Gaint("enemy32");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY33){
				Gaint chara = new Gaint("enemy33");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY34){
				Gaint chara = new Gaint("enemy34");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY35){
				Gaint chara = new Gaint("enemy35");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY36){
				Gaint chara = new Gaint("enemy36");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY37){
				Gaint chara = new Gaint("enemy37");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY38){
				Gaint chara = new Gaint("enemy38");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY39){
				Gaint chara = new Gaint("enemy39");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 

			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY41){
				Gaint chara = new Gaint("enemy41");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 

			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY43){
				Gaint chara = new Gaint("enemy43");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY44){
				Gaint chara = new Gaint("enemy44");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY45){
				Gaint chara = new Gaint("enemy45");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY46){
				Gaint chara = new Gaint("enemy46");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.BOSS1){
				Gaint chara = new Gaint("boss1");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.BOSS2){
				Gaint chara = new Gaint("boss2");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 


			//used enemies model
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY18){
				Gaint chara = new Gaint("enemy18");
				chara.SetArmor(armorList[0]);
				chara.SetIsPonsion(false);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,hpList[0]);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY23){
				Gaint chara = new Gaint("enemy23");
				chara.SetArmor(armorList[1]);
				chara.SetIsPonsion(false);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,hpList[1]);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY26){
				Gaint chara = new Gaint("enemy26");
				chara.SetArmor(armorList[2]);
				chara.SetIsPonsion(false);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,hpList[2]);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY29){
				Gaint chara = new Gaint("enemy29");
				chara.SetArmor(armorList[3]);
				chara.SetIsPonsion(false);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,hpList[3]);
				tempChar = chara;
			}
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY40){
				Gaint chara = new Gaint("enemy40");
				chara.SetArmor(armorList[4]);
				chara.SetIsPonsion(false);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,hpList[4]);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY42){
				Gaint chara = new Gaint("enemy42");
				chara.SetArmor(armorList[5]);
				chara.SetIsPonsion(false);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,hpList[5]);
				tempChar = chara;
			} 


			if(tempChar != null){
				chars.Add(tempChar);
			} else {
				throw new UnityException("no current char type to spawn!");
			}
		}
		//create the building
		else if (classType == CharacterData.CharacterClassType.BUILDING) {
			//create the barrack to gather resources
			if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.BARRACK){
				TowerBarrack character = new TowerBarrack();
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetCamp(camp);
				tempChar = character;
			} else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.CANNON){
				Cannon character = new Cannon();
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose (pose);
				character.SetCamp(camp);
				//set attack power
				character.SetAttackPower(50);
				tempChar = character;
			}
			//Tower01
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER1){
				Tower1 character = new Tower1();
				character.SetAttackRange(2.25f);
				character.SetLevel(1);
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose (pose);
				character.SetCamp(camp);
				character.SetAttackRate(1f);
				character.SetNeedPower(towerPowerList[0]);
				//set attack power
				character.SetAttackPower(tower1AttackNumber);
				tempChar = character;
			}
			//Tower02
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER2){
				Tower2 character = new Tower2();
				character.SetAttackRange(2);
				character.SetLevel(1);
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose (pose);
				character.SetCamp(camp);
				character.SetAttackRate(1f);
				character.SetNeedPower(towerPowerList[1]);
				//set attack power
				character.SetAttackPower(tower2AttackNumber);
				tempChar = character;
			}
			//Tower4
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER4){
				Tower4 character = new Tower4();
				character.SetAttackRange(2);
				character.SetLevel(1);
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose(pose);
				character.SetCamp(camp);
				character.SetNeedPower(towerPowerList[2]);
				tempChar = character;
			}
			//Tower7
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER7){
				Tower7 character = new Tower7();
				character.SetAttackRange(2.5f);
				character.SetLevel(1);
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose(pose);
				character.SetCamp(camp);
				character.SetAttackPower(tower7AttackNumber);
				character.SetAttackRate(1f);
				character.SetNeedPower(towerPowerList[3]);
				tempChar = character;
			}
			//Tower10
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER10){
				Tower10 character = new Tower10();
				character.SetAttackRange(2.5f);
				character.SetLevel(1);
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose(pose);
				character.SetCamp(camp);
				character.SetAttackPower(tower10AttackNumber);
				character.SetAttackRate(1f);
				character.SetNeedPower(towerPowerList[4]);
				tempChar = character;
			}
			//Research
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.LAB){
				Research character = new Research();
				character.SetLevel(1);
				character.SetPos(pos);
				character.SetPose(pose);
				character.SetCamp(camp);
				tempChar = character;
			}
			//Diamond Resource
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.DIAMOND){
				DiamondResource character = new DiamondResource();
				character.SetPos(pos);
				character.SetPose(pose);
				character.SetCamp(camp);
				tempChar = character;
			}
			//Small Mine
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.MINE1){
				SmallMine character = new SmallMine();
				character.SetPos(pos);
				character.SetPose(pose);
				character.SetCamp(camp);
				tempChar = character;
			}
			//Large Mine
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.MINE2){
				LargeMine character = new LargeMine();
				character.SetPos(pos);
				character.SetPose(pose);
				character.SetCamp(camp);
				tempChar = character;
			}
			//Small Geneator
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.GENERATOR1){
				SmallGeneator character = new SmallGeneator();
				character.SetPos(pos);
				character.SetPose(pose);
				character.SetCamp(camp);
				tempChar = character;
			}
			//Large Geneator
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.GENERATOR2){
				LargeGeneator character = new LargeGeneator();
				character.SetPos(pos);
				character.SetPose(pose);
				character.SetCamp(camp);
				tempChar = character;
			}
			//Targeting Facility
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TARGETING){
				TargetingFacility character = new TargetingFacility();
				character.SetPos(pos);
				character.SetPose(pose);
				character.SetCamp(camp);
				character.SetAttackRange(1);
				character.SetNeedPower(towerPowerList[5]);
				tempChar = character;
			}
			//Super Capacitor
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.CAPACITOR){
				SuperCapacitor character = new SuperCapacitor();
				character.SetPos(pos);
				character.SetPose(pose);
				character.SetCamp(camp);
				character.SetAttackRange(1);
				character.SetNeedPower(towerPowerList[6]);
				tempChar = character;
			}
			//Alien Recovery
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.ALIEN){
				AlienRecovery character = new AlienRecovery();
				character.SetPos(pos);
				character.SetPose(pose);
				character.SetCamp(camp);
				character.SetAttackRange(2);
				tempChar = character;
			}
			//Antenna
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.ANTENNA){
				Antenna character = new Antenna();
				character.SetPos(pos);
				character.SetPose(pose);
				character.SetCamp(camp);
				character.SetAttackRange(antennaRange);
				tempChar = character;
			}
			//created the tower, add to the building list
			if(tempChar != null){
				building.Add(tempChar);
			} else { 
				throw new UnityException("no current building type to spawn!");
			}
		}
		//add to the all character list
		allCharacter.Add (tempChar);
		this.END_METHOD("SpawnCharacter");
		return tempChar;
	}
Example #56
0
 public RectangleCommand(Viking.UI.Controls.SectionViewerControl parent)
     : base(parent)
 {
 }
Example #57
0
 public PlaceStructureCommand(Viking.UI.Controls.SectionViewerControl parent)
     : base(parent)
 {
     this.Type = Viking.UI.State.SelectedObject as StructureType;
     parent.Cursor = Cursors.Cross;
 }
Example #58
0
 public AnnotationCommandBase(Viking.UI.Controls.SectionViewerControl parent)
     : base(parent)
 {
     //I hate this, but I have to live with it until Jotunn
     this.Overlay = AnnotationOverlay.CurrentOverlay;
 }
Example #59
0
        /// <summary>
        /// Returns annotations for section if they exist or creates new SectionLocationsViewModel if they do not
        /// </summary>
        /// <param name="SectionNumber"></param>
        public static SectionLocationsViewModel GetOrCreateAnnotationsForSection(int SectionNumber, 
                                                                                 Viking.UI.Controls.SectionViewerControl parent,
                                                                                 EventHandler AnnotationChangedEventHandler)
        {
            if (parent.Section.VolumeViewModel.SectionViewModels.ContainsKey(SectionNumber))
            {
                SectionLocationsViewModel SectionAnnotations = cacheSectionAnnotations.Fetch(SectionNumber);
                if (SectionAnnotations != null)
                    return SectionAnnotations;

                SectionAnnotations = new SectionLocationsViewModel(parent.Section.VolumeViewModel.SectionViewModels[SectionNumber],
                                                                                        parent);

                SectionLocationsViewModel retVal = cacheSectionAnnotations.GetOrAdd(SectionNumber, SectionAnnotations);

                //If we did add a new view model to the cache, then subscribe to events and reduce cache footprint if needed
                if (object.ReferenceEquals(retVal, SectionAnnotations))
                {
                    cacheSectionAnnotations.ReduceCacheFootprint(null);
                }
                else
                {
                    //Otherwise make the duplicate SectionLocationsViewModel go away
                    SectionAnnotations.Dispose();
                    SectionAnnotations = null;
                }

                return retVal;
            }

            return null;
        }
Example #60
0
 public ROIRectCommand(Viking.UI.Controls.SectionViewerControl ctrl)
     : base(ctrl)
 {
 }