Ejemplo n.º 1
0
    public AllColors()
    {
        Stone = new SoulColor("Stone", "Defense", new Weapon("Rock Fists", 60, 10), new Ammo("Rock Shards", 5, 1, 30));
        Metal = new SoulColor("Metal", "Defense", new Weapon("Metal Pole", 50, 20), new Ammo("Knives", 12, 3, 15));
        Grass = new SoulColor("Grass", "Speed", new Weapon("Thorn Whip", 40, 10), new Ammo("Ninja Stars", 10, 1, 20));
        Wood  = new SoulColor("Wood", "Attack Range", new Weapon("Wood Beam", 100, 15), new Ammo("Logs", 2, 1, 50));

        ColorList = new SoulColor[] { Stone, Metal, Grass, Wood };
    }
Ejemplo n.º 2
0
 void PrintColors()
 {
     Debug.Log(sappedColors.Count + " Colors Stored");
     for (int i = 0; i < sappedColors.Count; i++)
     {
         SoulColor currentColor = sappedColors.Dequeue();
         Debug.Log("Color " + (i + 1) + ": " + currentColor.Name);
         sappedColors.Enqueue(currentColor);
     }
 }
Ejemplo n.º 3
0
 void UseBoost()
 {
     if (sappedColors.Count > 0)
     {
         SoulColor currentColor = sappedColors.Dequeue();
         Debug.Log(currentColor.BoostEffect + " increased");
     }
     else
     {
         Debug.Log("No color available to use boost");
     }
 }
Ejemplo n.º 4
0
 void CreateWeapon()
 {
     if (sappedColors.Count > 0)
     {
         SoulColor currentColor = sappedColors.Dequeue();
         equippedWeapon = currentColor.ColorWeapon;
         Debug.Log("Equipped Weapon is " + equippedWeapon.Name);
     }
     else
     {
         Debug.Log("No color available to create weapon");
     }
 }
Ejemplo n.º 5
0
 void SapColor()
 {
     if (sappedColors.Count < 3)
     {
         SoulColor sappedColor = GetColor();
         sappedColors.Enqueue(sappedColor);
         Debug.Log("Sapped " + sappedColor.Name);
     }
     else
     {
         Debug.Log("Colors full");
     }
 }
Ejemplo n.º 6
0
    void PrintInfo()
    {
        string info = "Player\nEquipped Weapon: ";

        info += equippedWeapon == null ? "None" : equippedWeapon.Name;
        info += "\nColors[" + sappedColors.Count + "]: ";
        for (int i = 0; i < sappedColors.Count; i++)
        {
            SoulColor currentColor = sappedColors.Dequeue();
            info += currentColor.Name + ", ";
            sappedColors.Enqueue(currentColor);
        }

        Debug.Log(info);
    }
Ejemplo n.º 7
0
    void CreateRounds()
    {
        if (sappedColors.Count > 0)
        {
            SoulColor currentColor = sappedColors.Dequeue();
            roundsToFire.Enqueue(currentColor.AmmoType.RoundsPerShot);

            roundCount.Enqueue(currentColor.AmmoType.NumOfRounds);

            if (roundCount.Count == 1)
            {
                currentRoundCount = currentColor.AmmoType.NumOfRounds;
            }

            for (int i = 0; i < currentColor.AmmoType.NumOfRounds; i++)
            {
                rounds.Enqueue(new Round(currentColor.AmmoType.Damage));
            }
        }
        else
        {
            Debug.Log("No color available to create ammo");
        }
    }
Ejemplo n.º 8
0
    void NextColor()
    {
        SoulColor currentColor = sappedColors.Dequeue();

        sappedColors.Enqueue(currentColor);
    }
Ejemplo n.º 9
0
    public void SapTiles(GameObject[] tiles)
    {
        //Gets tiles in range
        List <Tile> tilesInRange = new List <Tile>();
        int         checkedTiles = 0;

        //Checks all tiles in tiles array
        while (checkedTiles < tiles.Length)
        {
            //Finds distance between
            Vector3 tileDistance = tiles[checkedTiles].transform.position - transform.position;

            //Stores tile if it within range
            if (tileDistance.magnitude < SapRange && !tiles[checkedTiles].GetComponent <Tile>().IsSapped)
            {
                tilesInRange.Add(tiles[checkedTiles].GetComponent <Tile>());
            }

            checkedTiles++;
        }

        if (tilesInRange.Count == 0)
        {
            Debug.Log("No Tiles To Sap");
            return;
        }

        //Creates ditionary to track the number of tiles with a certain color
        Dictionary <SoulColor, List <Tile> > tileColors = new Dictionary <SoulColor, List <Tile> >();

        foreach (Tile t in tilesInRange)
        {
            //Gets current tile's color
            SoulColor currentTileColor = allColors.ColorList[t.TileSoul];

            //If other tiles already have this color
            if (!tileColors.ContainsKey(currentTileColor))
            {
                //Add this color too the dictionary
                tileColors.Add(currentTileColor, new List <Tile>());
            }

            //Increase that color's count
            tileColors[currentTileColor].Add(t);
        }


        //Determines color to sap, one with most tiles
        SoulColor colorToSap = null;

        foreach (SoulColor s in tileColors.Keys)
        {
            if (colorToSap == null)
            {
                colorToSap = s;
            }
            else
            {
                if (tileColors[s].Count >= tileColors[colorToSap].Count)
                {
                    colorToSap = s;
                }
            }
        }

        foreach (Tile t in tileColors[colorToSap])
        {
            t.SapTile();
        }

        sappedColors.Enqueue(colorToSap);
        Debug.Log("Sapped " + colorToSap.Name);
    }