Exemple #1
0
    public static Color ColorGem(TileMeta.GemType gem)
    {
        switch (gem)
        {
        case TileMeta.GemType.Blue:
            return(new Color(.29f, .75f, .94f));

        case TileMeta.GemType.Fight:
            return(Color.magenta);

        case TileMeta.GemType.Gold:
            return(new Color(.8f, 0, 1f));

        case TileMeta.GemType.Green:
            return(new Color(.808f, .192f, 1f));

        case TileMeta.GemType.Purple:
            return(new Color(.349f, .58f, 1f));

        case TileMeta.GemType.Red:
            return(new Color(.216f, .216f, 1f));

        case TileMeta.GemType.Silver:
            return(new Color(.816f, .816f, 1f));
        }
        return(Color.white);
    }
Exemple #2
0
    //- [ ] Greed => Destroy more gems with skill
    public void destroySomeTiles(TileMeta.GemType toRemove, int min, int max)
    {
        min += (int)PanelManager.instance.getCurrentMonster().greed;
        max += (int)PanelManager.instance.getCurrentMonster().greed;

        int dmg = 0;
        List <GameObject> validTiles = new List <GameObject>();

        for (int x = 0; x < xSize; x++)
        {
            for (int y = 0; y < ySize; y++)
            {
                if (tiles[x, y].GetComponent <Tile>().type.type == toRemove)
                {
                    validTiles.Add(tiles[x, y]);
                }
            }
        }
        GameObject[] endTiles = validTiles.ToArray();
        GameUtilities.ShuffleArray(endTiles);
        int maxTls = UnityEngine.Random.Range(min, max + 1);

        for (int i = 0; i < maxTls && i < endTiles.Length; i++)
        {
            StartCoroutine(DestroyTile(endTiles[i].GetComponent <Tile>()));
            if (toRemove == TileMeta.GemType.Fight)
            {
                dmg++;
            }
        }
        Tile.characterHit(dmg);
        StartCoroutine(FindNullTiles());
    }
Exemple #3
0
    static string abbreviationGem(TileMeta.GemType gem)
    {
        switch (gem)
        {
        case TileMeta.GemType.Blue:
            return("<color=#59C4F0>(B)</color>");

        case TileMeta.GemType.Fight:
            return("<color=#E1A2A2>(F)</color>");

        case TileMeta.GemType.Gold:
            return("<color=#FFD52C>(Y)</color>");

        case TileMeta.GemType.Green:
            return("<color=#9FCE31>(G)</color>");

        case TileMeta.GemType.Purple:
            return("<color=#845994>(P)</color>");

        case TileMeta.GemType.Red:
            return("<color=#F23737>(R)</color>");

        case TileMeta.GemType.Silver:
            return("<color=#CCCCCC>(S)</color>");
        }
        return("");
    }
Exemple #4
0
    //- [ ] Lust => Change more gems with skill
    public void switchSomeTiles(TileMeta.GemType from, TileMeta.GemType to, int min, int max)
    {
        min += (int)PanelManager.instance.getCurrentMonster().lust;
        max += (int)PanelManager.instance.getCurrentMonster().lust;

        List <GameObject> validTiles = new List <GameObject>();

        for (int x = 0; x < xSize; x++)
        {
            for (int y = 0; y < ySize; y++)
            {
                if (tiles[x, y].GetComponent <Tile>().type.type == from)
                {
                    validTiles.Add(tiles[x, y]);
                }
            }
        }
        GameObject[] endTiles = validTiles.ToArray();
        GameUtilities.ShuffleArray(endTiles);
        int maxTls = UnityEngine.Random.Range(min, max + 1);

        for (int i = 0; i < maxTls && i < endTiles.Length; i++)
        {
            int idx = (new List <TileMeta.GemType>(gemTypes)).IndexOf(to);
            endTiles[i].GetComponent <Tile>().type.type = to;
            StartCoroutine(switchTwoTiles(endTiles[i].GetComponent <Tile>(), to, characters[idx]));
        }
        StartCoroutine(WaitThenCheck());
    }
Exemple #5
0
    public IEnumerator switchTwoTiles(Tile from, TileMeta.GemType to, Sprite img)
    {
        StartCoroutine(provideAnimation(playerTurn, from.transform, SkillEffect.Effect.Change, to));
        yield return(new WaitForSeconds(animationWait));

        from.GetComponent <Tile>().type.type        = to;
        from.GetComponent <SpriteRenderer>().sprite = img;
        //from.GetComponent<FadeMaterials>().FadeIn();
        //yield return new WaitForSeconds(.8f);
        //checkAllMatches ();
        yield return(null);
    }
Exemple #6
0
 public void switchAllTiles(TileMeta.GemType from, TileMeta.GemType to)
 {
     for (int x = 0; x < xSize; x++)
     {
         for (int y = 0; y < ySize; y++)
         {
             if (tiles[x, y].GetComponent <Tile>().type.type == from)
             {
                 int idx = (new List <TileMeta.GemType>(gemTypes)).IndexOf(to);
                 tiles[x, y].GetComponent <Tile>().type.type = to;
                 StartCoroutine(switchTwoTiles(tiles[x, y].GetComponent <Tile>(), to, characters[idx]));
             }
         }
     }
     StartCoroutine(WaitThenCheck());
 }
Exemple #7
0
    public void destroyTiles(TileMeta.GemType toRemove)
    {
        int dmg = 0;
        List <GameObject> validTiles = new List <GameObject>();

        for (int x = 0; x < xSize; x++)
        {
            for (int y = 0; y < ySize; y++)
            {
                if (tiles[x, y].GetComponent <Tile>().type.type == toRemove)
                {
                    StartCoroutine(DestroyTile(tiles[x, y].GetComponent <Tile>()));
                    if (toRemove == TileMeta.GemType.Fight)
                    {
                        dmg++;
                    }
                }
            }
        }
        Tile.characterHit(dmg);
        StartCoroutine(FindNullTiles());
    }
Exemple #8
0
    public IEnumerator sendProjectile(GameObject obj, bool playerToGem, Transform start, Transform dest, SkillEffect.Effect effect, TileMeta.GemType gem, Vector3 scale)
    {
        Vector3 sPos = new Vector3(start.position.x, start.position.y, 80);
        Vector3 ePos = new Vector3(dest.position.x, dest.position.y, 80);

        GameObject projectile = Instantiate(obj, playerToGem ? sPos : ePos, Quaternion.identity);

        projectile.transform.localScale = scale;

        projectile.GetComponent <ParticleSystem>().Play();
        if (effect != SkillEffect.Effect.Sabotage && effect != SkillEffect.Effect.None)
        {
            projectile.GetComponent <ParticleSystem>().startColor = SkillEffect.ColorGem(gem);
        }
        iTween.MoveTo(projectile, playerToGem ? ePos : sPos, animationWait - .1f);
        yield return(new WaitForSeconds(animationWait));

        Destroy(projectile);
    }
Exemple #9
0
    public IEnumerator provideAnimation(bool playerTurn, Transform dest, SkillEffect.Effect effect, TileMeta.GemType gem)
    {
        Glossary  glossy = PanelManager.instance.glossaryObj.GetComponent <Glossary>();
        Transform start  = GameObject.Find("HMonsterImg").transform;

        if (!playerTurn)
        {
            start = GameObject.Find("MMonsterImg").transform;
        }

        GameObject throwObj;
        bool       playerToGem = true;

        if (effect == SkillEffect.Effect.Change)
        {
            throwObj = glossy.GetParticleSystem("MagicParticleSystem");
            StartCoroutine(sendProjectile(throwObj, playerToGem, start, dest, effect, gem, Vector3.one));
        }
        else if (effect == SkillEffect.Effect.Sabotage)
        {
            throwObj = glossy.GetParticleSystem("PoisonParticleSystem");
            String[] playerPanels = new String[] { "HClick1", "HClick2", "HClick3", "HClick4" };
            String[] enemyPanels  = new String[] { "MClick1", "MClick2", "MClick3", "MClick4" };

            List <String> destinations = new List <string>();
            for (int i = 0; i < (playerTurn ? PanelManager.instance.getComputerSkills() : PanelManager.instance.getPlayerSkills()).Count; i++)
            {
                string    thisDest = playerTurn ? enemyPanels[i] : playerPanels[i];
                Transform newDest  = GameObject.Find(thisDest).transform;
                StartCoroutine(sendProjectile(throwObj, playerToGem, start, newDest, effect, gem, Vector3.one));
            }
        }
        else
        {
            throwObj    = glossy.GetParticleSystem("ExplosionParticleSystem");
            playerToGem = false;
            StartCoroutine(sendProjectile(throwObj, playerToGem, start, dest, effect, gem, Vector3.one));
        }

        yield return(null);
    }
Exemple #10
0
 public Sprite getGemSprite(TileMeta.GemType gem)
 {
     return(gems[(int)gem]);
 }