예제 #1
0
    private GridNode CheckforScopeToMove(TraversalDirection dir, int count)
    {
        GridNode node = gridManager.GetRandomPosition();
        GridNode n    = node;

        for (int i = 0; i < count; i++)
        {
            node = gridManager.GetNextNode(node, dir);
            if (node.isFilled)
            {
                return(null);
            }
        }
        return(n);
    }
예제 #2
0
 private void SetPositions(SnakeBlock block, GridNode node, GridSystemManager gridSystem, TraversalDirection dir)
 {
     if (block != null)
     {
         GridNode n = gridSystem.GetNextNode(node, dir);
         if (!n.isFilled)
         {
             block.SetPosition(n);
             SetPositions(block.backBlock, n, gridSystem, dir);
         }
     }
 }
예제 #3
0
 private bool IsValideMove(TraversalDirection dir)
 {
     currentNode = gridManager.GetNextNode(currentNode, dir);
     if (currentNode == null)
     {
         return(false);
     }
     if (currentNode.isFilled)
     {
         return(false);
     }
     snakeController.SetPosition(currentNode);
     if (fruitNode == currentNode)
     {
         SoundManager.AudioPlayEvent(ConstantsList.Sfx_Collect);
         Score++;
         snakeIntialSpeed -= Time.deltaTime * snakespeedIncreaserate;
         snakeController.GenerateTail();
         gridManager.SetCollectObject(fruitObj, PoolManager.GetInstance().GetPoolContainer(false), false, out fruitNode);
     }
     return(true);
 }