示例#1
0
    public void TestMethod1()
    {
        Options option;

        for (int i = 0; i < 10; ++i)
        {
            option = RandomEnum.Of <Options>();
            Console.WriteLine(option);
        }
    }
示例#2
0
    public virtual void GenerateQuality()   //if value <0 do random value. testing random material generation.
    {
        if (material == Material.Metal)
        {
            MetalMaterial randomMaterial = RandomEnum.Of <MetalMaterial>();

            name            = randomMaterial.ToString() + " " + name;
            levelMultiplyer = (int)randomMaterial + 1;//starts at zero
        }
        else if (material == Material.Wood)
        {
            WoodMaterial randomMaterial = RandomEnum.Of <WoodMaterial>();

            name            = randomMaterial.ToString() + " " + name;
            levelMultiplyer = (int)randomMaterial + 1;//starts at zero
        }
        else if (material == Material.Cloth)
        {
            LightMaterial randomMaterial = RandomEnum.Of <LightMaterial>();

            name            = randomMaterial.ToString() + " " + name;
            levelMultiplyer = (int)randomMaterial + 1;//starts at zero
        }
        else if (material == Material.Leather)
        {
            LeatherMaterial randomMaterial = RandomEnum.Of <LeatherMaterial>();

            name            = randomMaterial.ToString() + " " + name;
            levelMultiplyer = (int)randomMaterial + 1;//starts at zero
        }
        else if (material == Material.Gem)
        {
            GemMaterial randomMaterial = RandomEnum.Of <GemMaterial>();

            name            = randomMaterial.ToString() + " " + name;
            levelMultiplyer = (int)randomMaterial + 1;//starts at zero
        }


        //change values based on material quality;
        defence *= levelMultiplyer;
        //attackSpeed *= levelMultiplyer;??
    }
示例#3
0
    private void DoThings()
    {
        if (!intialized)
        {
            return;
        }
        if (!IsPerformingAction && Player != null)
        {
            DestinationTile = Player.GetComponent <PlayerData>().CurrentTile;
            int shortestDistance = PathNode.GetDistanceToNode(CurrentTile, DestinationTile, GameGrid);

            foreach (GameObject go in Player.GetComponent <PlayerData>().AllStructures)
            {
                int distance = PathNode.GetDistanceToNode(CurrentTile, go.GetComponent <StructureData>().CurrentTile, GameGrid);
                if (distance < shortestDistance && go.GetComponent <BeaconData>() != null)
                {
                    shortestDistance = distance;
                    DestinationTile  = go.GetComponent <StructureData>().CurrentTile;
                }
            }
            Tile realDestination = DestinationTile;
            if (shortestDistance > BeaconData.DistressRadius)
            {
                if (CurrentTile.Neighbours.Count > 0)
                {
                    Tile.Sides side;
                    do
                    {
                        side = RandomEnum.Of <Tile.Sides>();
                    } while (!CurrentTile.Neighbours.ContainsKey(side));
                    DestinationTile = CurrentTile.Neighbours[side];
                    if (DestinationTile.Neighbours.Count > 0)
                    {
                        do
                        {
                            do
                            {
                                side = RandomEnum.Of <Tile.Sides>();
                            } while (!DestinationTile.Neighbours.ContainsKey(side));
                            DestinationTile = DestinationTile.Neighbours[side];
                        } while (DestinationTile == CurrentTile);
                    }
                }
                else
                {
                    return;
                }
            }
            TileTobeMovedTo = CalculatePath();
            if (TileTobeMovedTo != CurrentTile)
            {
                TypeOfPerformingAction[PlayerActions.Move] = true;
                Vector3 dest = TileTobeMovedTo.Position;
                // Animator animCtrl = this.gameObject.GetComponent<Animator>();
                if (dest.x > Position.x)
                {
                    direction = 1;
                }
                else if (dest.x < Position.x)
                {
                    direction = -1;
                }
                IsPerformingAction     = true;
                CurrentTile.Savior     = null;
                TileTobeMovedTo.Savior = this.gameObject;
            }
        }
    }