Beispiel #1
0
 // Use this for initialization
 void Start()
 {
     winConditions = gameObject.GetComponent <ThreatCheckScript>();
     board         = gameObject.GetComponent <DrawBoardScript>();
     utility       = gameObject.GetComponent <UtilityScripts>();
     placePiece    = gameObject.GetComponent <GamePieceScript>();
     eval          = gameObject.GetComponent <EvaluateBoardScript>();
 }
 // Use this for initialization
 void Start()
 {
     placePiece     = gameObject.GetComponent <GamePieceScript>();
     gameBoard      = gameObject.GetComponent <DrawBoardScript>().drawnGameBoard;
     utility        = gameObject.GetComponent <UtilityScripts>();
     gameData       = gameObject.GetComponent <GameController>();
     gameBoardState = gameObject.GetComponent <DrawBoardScript>().gameBoardState;
 }
Beispiel #3
0
 // Update is called once per frame
 void Update()
 {
     if (started)
     {
         if (!rt)
         {
             rt = GetComponent <RectTransform>();
         }
         float   newHeight   = UtilityScripts.Remap(currValue, -1, 1, UtilityScripts.miny, UtilityScripts.maxy);
         Vector2 destination = new Vector2(rt.anchoredPosition.x, newHeight);
         Vector2 nextPos     = Vector2.Lerp(rt.anchoredPosition, destination, smooth * Time.deltaTime);
         rt.anchoredPosition = nextPos;
     }
 }
Beispiel #4
0
    // Use this for initialization
    void Start()
    {
        if (m_puzzle == null)
        {
            m_puzzle = ScriptableObject.CreateInstance <PuzzleData>();
        }

        m_Bounds = new Bounds(transform.position, Vector3.zero);

        m_grid = new GameObject[(m_puzzle.m_width + 1) * (m_puzzle.m_height + 1)];

        // Build Grid
        for (int x = 0; x < m_puzzle.m_width; x++)
        {
            for (int y = 0; y < m_puzzle.m_height; y++)
            {
                int datVal = m_puzzle.m_data [x + m_puzzle.m_width * y];

                if (datVal > 0)
                {
                    CreateBlock(x, y, datVal);
                }
                else
                {
                    CreateDirBlock(x, y);
                }
            }
        }

        // Edges
        CreateBlock(-1, -1, 0);
        for (int y = 0; y < m_puzzle.m_height; y++)
        {
            CreateDirBlock(-1, y);
        }

        for (int x = 0; x < m_puzzle.m_width; x++)
        {
            CreateDirBlock(x, -1);
        }

        // Frame Camera
        UtilityScripts.FrameBounds(Camera.main, m_Bounds, Vector3.forward);

        //
        m_inputBlocks = GetComponentsInChildren <KaBlockInput>();
    }
 void Start()
 {
     utility       = gameObject.GetComponent <UtilityScripts>();
     winConditions = gameObject.GetComponent <ThreatCheckScript>();
     drawBoard     = gameObject.GetComponent <DrawBoardScript>();
 }