示例#1
0
        private void DeleteIsland(Island island)
        {
            var index = DrawingIslands.IndexOf(island);

            if (index == -1)
            {
                return;
            }
            DrawingIslands[index] = null;
            gOM.DestroyObj(DrawingIslandViews[index]);
            DrawingIslandViews[index] = null;
            DrawingSizes[index]       = -1f;
        }
示例#2
0
        public IslandElement GetSkeleton(Island visIsland, Vector3 pos, Team team, Random r)
        {
            var skeleton = GetDefaultUnit(visIsland, pos, team);

            skeleton.MaxSpeed = 3f + 0.3f * r.Next(0, 5);
            skeleton.LifeController.SetLifePoints(5, 5);
            skeleton.FightingController.EnableAttack(2, 25);
            skeleton.FightingController.EnableCanBeAttacked(3);
            skeleton.IslandElementViewSettings = new IslandElementViewSettings()
            {
                GetGameObject = () => viewFac.GetSkeletonVisualization(), HasLifeStatVisualization = true
            };
            return(skeleton);
        }
 public void EnterIsland(Island island)
 {
     if (island == IslandElement.Island)
     {
         return;
     }
     if (IslandElement.Island != null)
     {
         IslandElement.Island.ContainerControllerIsland.RemoveElement(IslandElement);
     }
     if (island != null)
     {
         island.ContainerControllerIsland.AddElement(IslandElement);
     }
 }
示例#4
0
        public void SetAMushroom(FactoryProvider provider, Vector3 relPosition, Island island, System.Random rand)
        {
            var mushroom = GetBasicResource(provider, relPosition, island, rand);

            mushroom.HarvestController.harvestTactic = new SimpleHarvestedControllerTactic(mushroom, InventoryType: inventoryDatabase.BrownMushroom);
            var resourceCount = new Dictionary <InventoryType, int>();

            mushroom.IslandElementViewSettings = new IslandElementViewSettings()
            {
                GetGameObject = () => viewFac.GetBrownMushroomVisualization(rand.Next()), HasLifeStatVisualization = false
            };
            resourceCount[inventoryDatabase.BrownMushroom] = 1;
            mushroom.HarvestInfo = new HarvestInfo(false, false, resourceCount, resourceCount, false, false, true, false);
            mushroom.CircleElementProperties.OriginalRadius = 0.2f;
            mushroom.Size = 1f;
        }
示例#5
0
        public void SetGrass(FactoryProvider provider, Vector3 relPosition, Island island, System.Random rand)
        {
            var grass = GetBasicResource(provider, relPosition, island, rand);

            grass.IslandElementViewSettings = new IslandElementViewSettings()
            {
                GetGameObject = () => viewFac.GetGrassVisualization(rand.Next())
            };
            grass.CircleElementProperties         = new CircleElementProperties(0.5f, 0.5f);
            grass.HarvestController.harvestTactic = new SimpleHarvestedControllerTactic(grass, InventoryType: inventoryDatabase.Grass);
            var resourceCount = new Dictionary <InventoryType, int>();

            resourceCount[inventoryDatabase.Grass] = 1;
            grass.HarvestInfo = new HarvestInfo(false, false, resourceCount, resourceCount, false, false, true, false);
            grass.Size        = 1;
        }
示例#6
0
        public void SetATree(FactoryProvider provider, Vector3 relPosition, Island island, System.Random rand)
        {
            var tree = GetBasicResource(provider, relPosition, island, rand);

            tree.IslandElementViewSettings = new IslandElementViewSettings()
            {
                GetGameObject = () => viewFac.GetTreeVisualization(rand.Next(0, 100)), HasLifeStatVisualization = false
            };
            var resourceCount = new Dictionary <InventoryType, int> {
            };

            resourceCount[inventoryDatabase.Wood] = 5;
            tree.HarvestController.SetHarvestSettings(
                new SimpleHarvestedControllerTactic(tree, InventoryType: inventoryDatabase.Wood), new HarvestInfo(true, false, resourceCount, resourceCount, false, false, false, false));
            tree.SizeController = new ResourceAmountSizeController(inventoryDatabase.Wood);
        }
示例#7
0
        public void SetARock(FactoryProvider provider, Vector3 relPosition, Island island, System.Random rand)
        {
            var rock = GetBasicResource(provider, relPosition, island, rand);

            rock.SizeController = new ResourceAmountSizeController(inventoryDatabase.Stone);
            rock.HarvestController.harvestTactic = new SimpleHarvestedControllerTactic(rock, InventoryType: inventoryDatabase.Stone);
            var resourceCount = new Dictionary <InventoryType, int>();
            var isBig         = rand.Next(0, 2) > 0;

            rock.IslandElementViewSettings = new IslandElementViewSettings()
            {
                GetGameObject = () => viewFac.GetRockVisualization(isBig, rand.Next()), HasLifeStatVisualization = false
            };
            resourceCount[inventoryDatabase.Stone] = isBig ? 2 : 1;
            rock.HarvestInfo = new HarvestInfo(true, false, resourceCount, resourceCount, false, false, false, false);
        }
示例#8
0
        public IslandElement GetSpawnedFighter(IslandElement spawner, Island island, Vector3 pos, Team team, bool isArcher)
        {
            var fighter = GetDefaultUnit(island, pos, team);

            fighter.LifeController.SetLifePoints(5, 5);
            var attackRange  = isArcher ? 70 : 25;
            var attackDamage = isArcher ? 1 : 2;

            fighter.FightingController.EnableAttack(attackDamage, attackRange);
            fighter.FightingController.EnableCanBeAttacked(3);
            fighter.IslandElementViewSettings = new IslandElementViewSettings()
            {
                GetGameObject = () => viewFac.GetFighterVisualization(), HasLifeStatVisualization = true
            };
            fighter.ActionHandler.SetNextCommand(new FollowAndProtectCommand(spawner));
            return(fighter);
        }
示例#9
0
        private void AddIsland(Island island)
        {
            var index = DrawingIslands.IndexOf(null);

            if (index == -1)
            {
                index = DrawingIslands.Count;
                DrawingIslands.Add(null);
                DrawingIslandViews.Add(null);
                DrawingSizes.Add(-1);
            }
            DrawingIslands[index]     = island;
            DrawingIslandViews[index] = gOM.LoadViaResources("IslandMinimap");
            var child = DrawingIslandViews[index].transform.GetChild(0).gameObject;

            child.GetComponent <MeshRenderer>().material.color = Color.yellow;
        }
示例#10
0
        public void SetANatureElement(FactoryProvider provider, Vector3 relPosition, Island island, System.Random rand)
        {
            var selected = rand.Next(8);

            if (selected == 0)
            {
                SetARock(provider, relPosition, island, rand);
            }
            if (selected == 1)
            {
                SetATree(provider, relPosition, island, rand);
            }
            if (selected == 2)
            {
                SetAMushroom(provider, relPosition, island, rand);
            }
            if (selected > 2 && selected < 8)
            {
                SetGrass(provider, relPosition, island, rand);
            }
        }
示例#11
0
        public void SetNatureElements(FactoryProvider provider, Island island, System.Random rand)
        {
            var size = Mathf.RoundToInt(island.Size);

            if (size < 5)
            {
                return;
            }
            var sizeSq    = (size - 1) * (size - 1);
            var minsQ     = 4 * 4;
            var sizeBiCub = (size - 1) * (size - 1) * size * size;
            var nbTrees   = (size * size / 10 + rand.Next(0, size * size / 20)) / 4;

            for (int i = 0; i < nbTrees; i++)
            {
                var radiusForTree = Mathf.Sqrt(rand.Next(minsQ, sizeSq));
                var angle         = (float)rand.NextDouble() * 360;
                var pos           = new Vector3(radiusForTree * Mathf.Cos(angle), 0, radiusForTree * Mathf.Sin(angle));
                SetANatureElement(provider, pos, island, rand);
            }
        }
示例#12
0
        public IslandElement GetWizard(IElementalType eType, Island visIsland, Vector3 pos, Team team)
        {
            var wizard = GetDefaultUnit(visIsland, pos, team);

            wizard.IslandElementViewSettings = new IslandElementViewSettings()
            {
                GetGameObject = () => viewFac.GetWizardVisualization(), HasLifeStatVisualization = true
            };
            wizard.hasLight = true;
            var elementalInfo = eType.IsWater ? new ElementalInfo(13, 13, 16, 11, 13) : new ElementalInfo(eType, 2);

            wizard.ElementalController.SetInfo(elementalInfo, eType, true);
            wizard.HarvestController.SetHarvestSettings(new HumanHarvestControllerTactic(wizard), new HarvestInfo(false, false, null, null, true, true, true, true));
            wizard.MaxSpeed = 6f;
            wizard.LifeController.SetLifePoints(50, 50);
            wizard.MagicController.EnableMagic(70, 100);
            wizard.HydrationController.EnableDehydrating(60, 80, 80);
            wizard.FightingController.EnableAttack(3, 6);
            wizard.InventoryController.HasInventory = true;
            wizard.ItemUsageController.usageTactic  = new WizardItemUsageControllerTactic(inventoryDb);
            return(wizard);
        }
 public IslandManaController(Island Island, IslandManaControllerFactory IslandManaControllerFactory)
 {
     Init(Island, IslandManaControllerFactory);
 }
示例#14
0
 public OnIslandNearityController(Island Island, OnIslandNearityControllerFactory OnIslandNearityControllerFactory)
 {
     Init(Island, OnIslandNearityControllerFactory);
 }
示例#15
0
        public void ExtendIsland(Island Island)
        {
            var element = new IslandSizeController(Island, this);

            Elements.Add(Island, element);
        }
示例#16
0
 public override void Init(Island Island, InterIslandCollisionFactory InterIslandCollisionFactory)
 {
     this.Island = Island;
     fac         = InterIslandCollisionFactory;
     fac.AddIsland(Island);
 }
示例#17
0
 public InterIslandCollision(Island Island, InterIslandCollisionFactory InterIslandCollisionFactory)
 {
     Init(Island, InterIslandCollisionFactory);
 }
 public GoToIslandPositionCommand(IslandElement IslandElement, Vector3 absolutePosition, Island onWhich)
 {
     this.intendedPosition = absolutePosition;
     this.onWhich          = onWhich;
 }
 public override void Init(Island Island, OnIslandCollisionFactory OnIslandCollisionFactory)
 {
     Island.IslandCollision = this;
 }
 public IslandMovementController(Island Island, IslandMovementControllerFactory IslandMovementControllerFactory)
 {
     Init(Island, IslandMovementControllerFactory);
 }
示例#21
0
 public GoToRelativePositionAction(Vector3 relativePosition, Island island, float arrivedDistance)
 {
     this.arrivedDistance  = arrivedDistance;
     this.RelativePosition = relativePosition;
     this.Island           = island;
 }
        public void ExtendIsland(Island Island)
        {
            var element = new OnIslandCollision(Island, this);

            Elements.Add(Island, element);
        }
示例#23
0
        public void ExtendIsland(Island Island)
        {
            var element = new OnIslandNearityController(Island, this);

            Elements.Add(Island, element);
        }
示例#24
0
 public IslandCollisionSizeManager(Island Island, IslandCollisionSizeManagerFactory IslandCollisionSizeManagerFactory)
 {
     Init(Island, IslandCollisionSizeManagerFactory);
 }
示例#25
0
 public override void Init(Island Island, IslandSizeControllerFactory IslandSizeControllerFactory)
 {
     Island.SizeController = this;
     this.Island           = Island;
     base.Init(Island, IslandSizeControllerFactory);
 }
示例#26
0
 public override void Init(Island Island, ContainerControllerIslandFactory ContainerControllerIslandFactory)
 {
     Island.ContainerControllerIsland = this;
     this.Island = Island;
     base.Init(Island, ContainerControllerIslandFactory);
 }
 public IslandSizeController(Island Island, IslandSizeControllerFactory IslandSizeControllerFactory)
 {
     Init(Island, IslandSizeControllerFactory);
 }
 public OnIslandCollision(Island Island, OnIslandCollisionFactory OnIslandCollisionFactory)
 {
     Init(Island, OnIslandCollisionFactory);
 }
 public IslandUnityView(Island Island, IslandUnityViewFactory IslandUnityViewFactory)
 {
     Init(Island, IslandUnityViewFactory);
 }
示例#30
0
        public IslandElement GetBasicResource(FactoryProvider provider, Vector3 relPosition, Island island,
                                              System.Random rand)
        {
            var fP       = provider;
            var resource = fP.IslandElementFactory.Create();

            resource.Factory = fP.IslandElementFactory;
            resource.CircleElementProperties = new CircleElementProperties(0.5f, 0.5f);
            island.ContainerControllerIsland.AddElement(resource);
            resource.RelativeToContainerPosition = relPosition;
            resource.Size = 1;
            return(resource);
        }