Example #1
0
    public void ForeachPiceOfBlockWhitShift(Action <Pice, Vector2Int> callback)
    {
        var dic = DicPool.Take();

        _ForeachPickOfBlockWithShift(dic, new Vector2Int(0, 0), callback);
        DicPool.Put(dic);
    }
Example #2
0
 private void Update()
 {
     if (Input.anyKey)
     {
         if (Input.GetKeyDown(KeyCode.UpArrow))
         {
             Bullet b = DicPool.GetBullet();
             b.transform.Rotate(Vector3.forward * -90);
             b.dirt = Vector3.right * -5;
         }
         else if (Input.GetKeyDown(KeyCode.DownArrow))
         {
             Bullet b = DicPool.GetBullet();
             b.transform.Rotate(Vector3.forward * 90);
             b.dirt = Vector3.right * -5;
         }
         else if (Input.GetKeyDown(KeyCode.LeftArrow))
         {
             Bullet b = DicPool.GetBullet();
             b.dirt = Vector3.right * -5;
         }
         else if (Input.GetKeyDown(KeyCode.RightArrow))
         {
             Bullet b = DicPool.GetBullet();
             b.transform.Rotate(Vector3.forward * 180);
             b.dirt = Vector3.right * -5;
         }
     }
 }
Example #3
0
    /// <summary>
    /// 遍历被这个 pice 连结到的 pice (包括自身)
    /// </summary>
    /// <param name="callback"></param>
    public void ForeachPiceOfBlock(Action <Pice> callback)
    {
        var dic = DicPool.Take();

        _ForeachPickOfBlock(dic, callback);
        DicPool.Put(dic);
    }
Example #4
0
    private IEnumerator PlayCompleteTask()
    {
        var temp = DicPool.Take();
        var rank = new List <List <Pice> >();
        var r1   = new List <Pice>();

        r1.Add(lastDragPice);
        rank.Add(r1);
        temp[lastDragPice] = true;

        var next = new List <Pice>();
        var last = r1;

here:
        foreach (var pice in last)
        {
            foreach (var linking in pice.linkingList)
            {
                var nextPice = linking.pice;
                if (temp.ContainsKey(nextPice) && temp[nextPice])
                {
                    continue;
                }
                next.Add(nextPice);
                temp[nextPice] = true;
            }
        }
        if (next.Count > 0)
        {
            rank.Add(next);
            last = next;
            next = new List <Pice>();
            goto here;
        }
        DicPool.Put(temp);

        AudioManager.PlaySe("level-complete-wave");
        foreach (var list in rank)
        {
            foreach (var pice in list)
            {
                pice.Flash();
            }
            yield return(new WaitForSeconds(0.15f));
        }
        yield return(new WaitForSeconds(0.15f));

        AudioManager.PlaySe("level-complete");
        Complete?.Invoke();
    }
Example #5
0
 private void destroy()
 {
     reset();
     DicPool.RecycleBullet(this);
 }
Example #6
0
 private void OnBecameInvisible()
 {
     gameObject.SetActive(false);
     DicPool.RecycleShape(this);
 }
Example #7
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     gameObject.SetActive(false);
     DicPool.RecycleShape(this);
 }
Example #8
0
    private void newShape()
    {
        Shape s = DicPool.GetShape();

        s.move();
    }