Example #1
0
 public MatchResult(Pattern pattern, int x, int y, E_BlockType type)
 {
     this.pattern = pattern;
     this.x = x;
     this.y = y;
     this.type = type;
 }
Example #2
0
        private static BaseBlock SelectBlock(E_BlockType blockType)
        {
            switch (blockType)
            {
            case (E_BlockType)0:
                return(new Block_I(m_Prefab));

            case (E_BlockType)1:
                return(new Block_J(m_Prefab));

            case (E_BlockType)2:
                return(new Block_L(m_Prefab));

            case (E_BlockType)3:
                return(new Block_O(m_Prefab));

            case (E_BlockType)4:
                return(new Block_S(m_Prefab));

            case (E_BlockType)5:
                return(new Block_T(m_Prefab));

            case (E_BlockType)6:
                return(new Block_Z(m_Prefab));

            default:
                return(new Block_I(m_Prefab));
            }
        }
Example #3
0
 private Block(E_HeroType heroType, E_BlockType type, int x, int y)
     : base(1, 1, WorldAnchor.MiddleCenter)
 {
     this._heroType = heroType;
     this._blockType = type;
     this.x = x;
     this.y = y;
 }
Example #4
0
    void AttachChargeGuage(string assetPath, E_BlockType blockType)
    {
        Assert.IsTrue(!chargeDisplays.ContainsKey(blockType));

        GameObject gameObject = RecycleManager.Instance.Instantiate(assetPath);
        chargeDisplays.Add(blockType, gameObject.AddComponent<UIChargeDisplay>());
        gameObject.transform.localScale = Vector3.one / 50f;
        AttachChild(gameObject, "TC", new Vector3(0, 0, 0.5f));
    }
Example #5
0
 public void ChangeBlock(E_BlockType from, E_BlockType to, PuzzlePanel.BlockChangeHandler blockChangeHandler)
 {
     blocks.ForAll(
         delegate(int x, int y, ref Block cell, ref bool stop)
         {
             if (cell != null && cell.blockType == from)
             {
                 cell.ChangeTo(to);
                 blockChangeHandler(from, to, x, y);
             }
         }
     );
 }
Example #6
0
 static float GetInARowFactorRatio(E_BlockType type)
 {
     switch (type)
     {
         case E_BlockType.Attack1:
         case E_BlockType.Attack2:
         case E_BlockType.Defend:
         case E_BlockType.Gather:
             return 0.5f;
         case E_BlockType.Ability:
             return 1f;
         case E_BlockType.Item:
             return 0.1f;
     }
     return 0f;
 }
Example #7
0
 public float GetChargePointRatio(E_BlockType blockType)
 {
     return board.GetChargePointRatio(blockType);
 }
Example #8
0
 void OnRemoveBlock(E_BlockType blockType, int x, int y)
 {
     BlockEntity blockEntity = board.blocks[blockType];
     AttachEffect(blockEntity.removeVFX, new Vector2(x, y), 1);
 }
Example #9
0
 public int GetChargeCount(E_BlockType blockType)
 {
     return board.GetChargeCount(blockType);
 }
Example #10
0
    bool TryPattern(Pattern pattern, int x, int y, out E_BlockType refType)
    {
        refType = E_BlockType.Invalid;
        if (ContainsInvalid(pattern, x, y))
        {
            return false;
        }

        if (!ContainsLive(pattern, x, y))
        {
            return false;
        }

        refType = FindRefType(pattern, x, y);
        if (refType == E_BlockType.Invalid)
        {
            // straight star is invalid
            return false;
        }

        if (CheckStraight(pattern, x, y, refType))
        {
            MarkDead(pattern, x, y);
            return true;
        }
        return false;
    }
Example #11
0
 void OnChangeBlock(E_BlockType from, E_BlockType to, int x, int y)
 {
     BlockEntity blockEntity = board.blocks[to];
     AttachEffect(blockEntity.TransformVFX, new Vector2(x, y), 1);
 }
Example #12
0
 public BaseBlock(E_BlockType blockType, GameObject prefab)
 {
     BlockType = blockType;
     m_Prefab  = prefab;
     InstantiateElements();
 }
Example #13
0
 public void ChangeTo(E_BlockType type)
 {
     _blockType = type;
     DestroyGameObject();
 }
Example #14
0
        public static BaseBlock CreateBlock(E_BlockType blockType, GameObject elementPrefab)
        {
            m_Prefab = elementPrefab;

            return(SelectBlock(blockType));
        }
Example #15
0
 public void RemoveAll(E_BlockType blockType, PuzzlePanel.BlockRemoveHandler handler)
 {
     sequence.blocks.ForAll(
         delegate(int x, int y, ref Block cell, ref bool stop)
         {
             if (cell != null && cell.blockType == blockType)
             {
                 if (handler != null)
                 {
                     handler(blockType, x, y);
                 }
                 cell.Destroy();
                 cell = null;
             }
         }
     );
     fsm.Event("RemoveBlock");
 }
Example #16
0
 public float GetChargePointRatio(E_BlockType blockType)
 {
     if (matchingResult != null)
     {
         var match = matchingResult.FirstOrDefault(x => x.blockEntity.BlockType == blockType);
         if (match != null)
         {
             return match.ChargePointRatio;
         }
     }
     return 0f;
 }
Example #17
0
 public int GetChargeCount(E_BlockType blockType)
 {
     if (matchingResult != null)
     {
         var match = matchingResult.FirstOrDefault(x => x.blockEntity.BlockType == blockType);
         if (match != null)
         {
             return match.ChargeCount;
         }
     }
     return 0;
 }
Example #18
0
    public void ChangeBlock(E_BlockType[] from, E_BlockType to, PuzzlePanel.BlockChangeHandler blockChangeHandler)
    {
        nextSequence = new Sequence(sequence.ExportMatrix());
        foreach (var entity in from)
        {
            nextSequence.ChangeBlock(entity, to, blockChangeHandler);
        }

        fsm.Event("ChangeBlock");
    }
Example #19
0
    static string ApplyScaleAndCritical(string pattern, Stat stat, E_BlockType type, float effectFactor, int inARowCount, bool isCharged)
    {
        float inARowFactor = (inARowCount - 3) * GetInARowFactorRatio(type);
        float ciriticalFactor = 0f;
        float extraDamageFactor = 0f;
        if (stat != null)
        {
            if (type == E_BlockType.Attack1 || type == E_BlockType.Attack2)
            {
                int parenOpen;
                int parenclose;
                SearchParenIndexs(pattern, "Attack", out parenOpen, out parenclose);

                bool isCritical = RandomTool.IsIn(stat.Get(ItemHeroStat.criticalHitChance));
                if (isCritical)
                {
                    pattern = pattern.Insert(parenclose, "; param=critical");
                    ciriticalFactor = stat.Get(ItemHeroStat.criticalHitDamage);
                }
                if (isCharged)
                {
                    pattern = pattern.Insert(parenclose, "; param=charged");
                }

                extraDamageFactor = stat.Get(ItemHeroStat.extraDamageFactor);
            }
        }
        return string.Format(pattern, 1 + effectFactor + inARowFactor + ciriticalFactor + extraDamageFactor);
    }
Example #20
0
 private bool CheckStraight(Pattern pattern, int x, int y, E_BlockType refType)
 {
     return blocks.ForPatternIn<bool>(pattern, x, y,
         true,
         delegate(int i, int j, ref E_BlockType cell, ref bool stop)
         {
             if (cell != E_BlockType.WildCard && cell != refType)
             {
                 stop = true;
                 return false;
             }
             return true;
         }
     );
 }