Exemple #1
0
 public void UpdateField(BlockLogic block)
 {
     for (int y = 0; y < Height; y++)
     {
         for (int x = 0; x < Width; x++)
         {
             if (Field[x, y] != null)
             {
                 if (Field[x, y].parent == block.transform)
                 {
                     Field[x, y] = null;
                 }
             }
         }
     }
     foreach (Transform bl in block.transform)
     {
         Vector2 pos = Round(bl.position);
         {
             if (pos.y < Height)
             {
                 Field[(int)pos.x, (int)pos.y] = bl;
             }
         }
     }
 }
    private void activateBlock(int blockId)
    {
        //use block's previous speed
        BlockLogic bl = blocks[blockId].GetComponent <BlockLogic>();

        if (!bl.blockEnabled)
        {
            bl.blockEnabled = true;
        }
    }
    private void activateBlockWithSpeed(int blockId, float blockSpeed)
    {
        //change block's speed
        BlockLogic bl = blocks[blockId].GetComponent <BlockLogic>();

        if (!bl.blockEnabled)
        {
            bl.movementSpeed = blockSpeed;
            bl.blockEnabled  = true;
        }
    }
Exemple #4
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag.StartsWith("block"))
     { //state block collided
         BlockLogic script = collision.GetComponent <BlockLogic> ();
         Debug.Log("collision player-block detected. block's state = " + script.blockState);
         if (state != script.blockState)
         {
             die();
         }
     }
 }
Exemple #5
0
 public bool AboveField(BlockLogic figure)
 {
     for (int x = 0; x < Width; x++)
     {
         foreach (Transform block in figure.transform)
         {
             Vector2 pos = Round(block.position);
             if (pos.y > Height - 1)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Exemple #6
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     Debug.Log("collided, player");
     if (!gameObject.CompareTag("colors"))
     {
         if (collision.gameObject.tag.StartsWith("block"))
         {
             //state block collided
             BlockLogic script = collision.GetComponent <BlockLogic>();
             Debug.Log("collision detected. other's id = " + script.blockState);
             if (state != script.blockState)
             {
                 die();
             }
         }
         else if (collision.gameObject.CompareTag("colors"))
         {
             StartCoroutine(flickerPlayer());
         }
     }
 }
 public void DoStop()
 {
     BlockLogic.KillAllPulses();
 }