Exemplo n.º 1
0
    //게임 시작 준비.
    void UpdateGameIn()
    {
        //스테이지 구축.
        GameObject stage = GameObject.Find("Stage");

        if (stage == null)
        {
            stage      = Instantiate(m_stagePrefabs[m_gameCount]) as GameObject;
            stage.name = "Stage";
            return;
        }

        //페이드인을 기다립니다.
        GameObject[] blocks = GameObject.FindGameObjectsWithTag("Block");
        foreach (GameObject obj in blocks)
        {
            BlockScript b = obj.GetComponent <BlockScript>();
            if (b.IsFadeIn())
            {
                return;
            }
        }

        //게임 시작으로 전환.
        m_state    = State.Game;
        m_gameTime = 0;

        //발사할 수 있게 합니다.
        GameObject[] bars = GameObject.FindGameObjectsWithTag("Bar");
        foreach (GameObject obj in bars)
        {
            BarScript bar = obj.GetComponent <BarScript>();
            bar.SetShotEnable(true);       //발사기능 OFF.
        }
    }
Exemplo n.º 2
0
    //스테이지를 바꾸는 연출..
    void UpdateGameChanging()
    {
        //초밥 페이드 아웃 시작.
        GameObject[] blocks = GameObject.FindGameObjectsWithTag("Block");
        foreach (GameObject obj in blocks)
        {
            BlockScript b = obj.GetComponent <BlockScript>();
            b.FadeOut();
        }

        //탄환 소거.
        GameObject[] balls = GameObject.FindGameObjectsWithTag("Ball");
        foreach (GameObject obj in balls)
        {
            Destroy(obj);
        }

        //발사할 수 없게 합니다.
        GameObject[] bars = GameObject.FindGameObjectsWithTag("Bar");
        foreach (GameObject obj in bars)
        {
            BarScript bar = obj.GetComponent <BarScript>();
            bar.SetShotEnable(false);       //발사 기능 OFF.
        }


        //다음 상태로 전환.
        m_state = State.GameOut;
    }
Exemplo n.º 3
0
    //게임 종료 준비.
    void UpdateGameOut()
    {
        // 페이드 아웃 대기.
        GameObject[] blocks = GameObject.FindGameObjectsWithTag("Block");
        foreach (GameObject obj in blocks)
        {
            BlockScript b = obj.GetComponent <BlockScript>();
            if (b.IsFadeOut())
            {
                return;
            }
        }

        //스테이지를 지웁니다.
        Destroy(GameObject.Find("Stage"));


        // 1게임 종료.
        ++m_gameCount;
        //Debug.Log("GameCount:" + m_gameCount);
        if (m_gameCount == GAMECOUNT_MAX)
        {
            m_state = State.GameEnd; // 정해진 게임 수에 도달했으므로 결과 화면으로 전환합니다.
        }
        else
        {
            m_state = State.GameIn; // 다음 게임으로 진행합니다.
        }
    }
Exemplo n.º 4
0
    //c indicates where the child's parent is in relation to it
    private void createChild(ShipChromosomeNode n, ChildNode c, ShipController s)
    {
        GameObject g = (GameObject)GameObject.Instantiate(
            Resources.Load(n.isEngine ? Config.ENGINE_PREFAB_LOCATION : Config.HEAVY_BLOCK_PREFAB_LOCATION),
            Vector3.zero,
            Quaternion.identity);

        if (n.isEngine)
        {
            EngineScript engine = g.GetComponent <EngineScript>();
            engine.initialize(s, n.startEngageAngle, n.rangeEngageAngle);
        }

        g.transform.parent        = transform;
        g.transform.localPosition = Vector3.zero;
        g.transform.localRotation = Quaternion.Euler(0, 0, n.relativeRotation);


        Vector3 colliderSize = g.GetComponent <MeshCollider>().bounds.size;

        switch (c)
        {
        case ChildNode.TOP:
            g.transform.localPosition = g.transform.localPosition
                                        + rotateByThisRotation(new Vector3(0, -colliderSize.y, 0));
            break;

        case ChildNode.BOTTOM:
            g.transform.localPosition = g.transform.localPosition
                                        + rotateByThisRotation(new Vector3(0, colliderSize.y, 0));
            break;

        case ChildNode.LEFT:
            g.transform.localPosition = g.transform.localPosition
                                        + rotateByThisRotation(new Vector3(colliderSize.x, 0, 0));
            break;

        case ChildNode.RIGHT:
            g.transform.localPosition = g.transform.localPosition
                                        + rotateByThisRotation(new Vector3(-colliderSize.x, 0, 0));
            break;
        }

        if (Physics.OverlapSphere(g.transform.position,
                                  (colliderSize.y < colliderSize.x
                                        ? colliderSize.y : colliderSize.x) / 2.1f).Length > 1)
        {
            GameObject.Destroy(g);
            return;
        }

        //FixedJoint fixedJoint = g.AddComponent<FixedJoint>();
        //fixedJoint.enableCollision = false;
        //fixedJoint.connectedBody = rigidbody;


        BlockScript b = g.GetComponent <BlockScript>();

        b.initialize(n, s);
    }
Exemplo n.º 5
0
 void Start()
 {
     Star          = GameObject.FindWithTag("Star");
     StarRigidbody = Star.GetComponent <Rigidbody>();
     blockscript   = GameObject.Find("Block_star").GetComponent <BlockScript>();
     Star.SetActive(false);
 }
Exemplo n.º 6
0
    void Start()
    {
        eliminateToLeCanvas = GameObject.Find("EliminateToLeCanvas").GetComponent <Canvas>();
        newYearPic          = eliminateToLeCanvas.transform.Find("NewYearPic").GetComponent <Image>();
        countDownBar        = eliminateToLeCanvas.transform.Find("CountDownBar").GetComponent <Slider>();

        mainCanvs = GameObject.Find("MainCanvas").GetComponent <Canvas>();
        manager   = GameObject.Find("CanvasManager").GetComponent <CanvasManager>();
        Block block = Resources.Load <Block>("Prefabs/Block");

        block = Instantiate(block);

        blockWidth  = Convert.ToInt32(block.GetComponent <RectTransform>().rect.width);
        blockHeight = Convert.ToInt32(block.GetComponent <RectTransform>().rect.height);

        //在右侧减少一列
        colBlockNum = width / blockWidth - 1;
        rowBlockNum = height / blockHeight;

        this.blockWidth  = blockWidth / 2;
        this.blockHeight = blockHeight / 2;

        blockScript = block.GetComponent <BlockScript>();

        DestroyImmediate(block.gameObject);
    }
Exemplo n.º 7
0
    public int CheckForHolesAtBlock(BlockScript checkBlock)
    {
        int holeDepth = checkBlock.y;

        if (checkBlock.y > 0 &&
            checkBlock.state != BlockState.Moving &&
            checkBlock.state != BlockState.Match &&
            checkBlock.state != BlockState.New)
        {
            foreach (KeyValuePair <int, BlockScript> kvp in fieldBlocks)
            {
                if (kvp.Value != null && kvp.Value != this)
                {
                    //Count how many blocks are below this to count the hole
                    if (kvp.Value.y >= 0 && kvp.Value.x == checkBlock.x && kvp.Value.y < checkBlock.y)
                    {
                        holeDepth--;
                    }
                }
            }

            return(holeDepth);
        }

        return(0);
    }
Exemplo n.º 8
0
    void LoadLevel()
    {
        SaveLoad.LoadMaps();
        Game currentGame = SaveLoad.savedMaps[gridSize][level];

        gridSize = currentGame.gridSize;

        //Get filled grid positions
        for (int n = 0; n < currentGame.filledListPosX.Count; n++)
        {
            GridScript.Instance.filledListPos.Add(new Vector2(currentGame.filledListPosX[n], currentGame.filledListPosY[n]));
            LogicManager.Instance.tilesLeft--;
        }
        GridScript.Instance.FillGrid();

        //Get blocks and resolutions
        foreach (SerializableBlock sBlock in currentGame.sBlockList)
        {
            GameObject blockGO = Instantiate(Resources.Load(string.Format("Prefabs/Block {0}/{1}", sBlock.tilesNumber, sBlock.blockName))) as GameObject;
            blockGO.transform.SetParent(GameObject.Find("Blocks").transform);
            BlockScript bScript = blockGO.GetComponent <BlockScript>();
            bScript.solutionIndex = sBlock.solvedIndex;
            bScript.solutionPos   = new Vector2(sBlock.solvedPosX, sBlock.solvedPosY);

            for (int r = 0; r < Random.Range(0, 4); r++)
            {
                blockGO.GetComponent <BlockScript>().RotateBlock();
            }
        }

        SpawnScript.Instance.DeleteSpawns();
        Debug.LogWarning("Map Loaded!");
    }
Exemplo n.º 9
0
    //Adjust avalible slots in Grid as tetrimino gameObjects move
    public void UpdateGrid(BlockScript blocks)
    {
        for (int y = 0; y < GridHeight; y++)
        {
            for (int x = 0; x < GridWidth; x++)
            {
                if (Grid [x, y] != null)
                {
                    if (Grid[x, y].parent == blocks.transform)
                    {
                        Grid[x, y] = null;
                    }
                }
            }
        }

        foreach (Transform mino in blocks.transform)
        {
            Vector2 pos = Round(mino.position);
            if (pos.y < GridHeight - 1)
            {
                Grid[(int)pos.x, (int)pos.y] = mino;
            }
        }
    }
Exemplo n.º 10
0
    public void BeginPathFind()
    {
        // Verify at least TWO END POINTS ARE SET!
        if (this.selectedPathPoints.Count != 2)
        {
            return;
        }

        JPSState.state = eJPSState.ST_FIND_PATH;         // transition state to Primary Jump Point Building State

        // Tell each child object to re-evaulte their rendering info
        foreach (GameObject child in childObjects)
        {
            BlockScript block_component = child.GetComponent <BlockScript>();
            block_component.setupDisplay();
        }

        BlockScript[] points = this.selectedPathPoints.ToArray();

        Point start = points[0].nodeReference.pos;
        Point stop  = points[1].nodeReference.pos;

        List <Point> path = grid.getPath(start, stop);

        if (path != null && path.Count != 0)
        {
            _pathRenderer.drawPath(path);                  // Draw Path on Screen
        }
    }
Exemplo n.º 11
0
    void CollisionFound(RaycastHit hit)
    {
        if (hit.collider.transform.parent)
        {
            BlockScript blockScript = hit.collider.transform.parent.GetComponent <BlockScript>();
            if (blockScript)
            {
                blockScript.WasHit(2);
            }
        }

        if (hit.collider.tag == "shield")
        {
            Destroy(gameObject);
            m_direction = Vector3.Reflect(m_direction, hit.normal);
        }
        else
        {
            if (hit.rigidbody)
            {
                TankScript tank = hit.rigidbody.GetComponent <TankScript>();
                if (tank)
                {
                    tank.Hit(gameObject);
                }
            }
            Bounce(hit.normal);
        }
    }
Exemplo n.º 12
0
    public BlockScript SetBelow()
    {
        //luodaan overlap joka kattoo onko alapuolella blokki
        Vector2 centerPoint = new Vector2(transform.position.x, transform.position.y - 0.54f);

        stuffBelow = Physics2D.OverlapPointAll(centerPoint);

        bool found = false;

        foreach (Collider2D col in stuffBelow)
        {
            if (col != gameObject.GetComponent <Collider2D>() && col != player.GetComponent <Collider2D>()) //TODO: siisti
            {
                blockBelow = col.gameObject.GetComponent <BlockScript>();
                found      = true;
                //print("ALLA ON " + blockBelow);
                //print(this + " is on top of " + blockBelow);
            }
        }
        if (!found)
        {
            blockBelow = null;
        }
        return(blockBelow);
    }
Exemplo n.º 13
0
 public void HoldBlocks(BlockScript toFall)
 {
     foreach (BlockScript block in toFall.group)
     {
         block.bs = BlockState.Hold;
     }
 }
Exemplo n.º 14
0
 public void SetBlockInGrid(BlockScript block)
 {
     posx = block.transform.position.x;
     posy = block.transform.position.y;
     blockGrid[Mathf.RoundToInt(posx), -Mathf.RoundToInt(posy)] = block;
     blockGrid[Mathf.RoundToInt(posx), -Mathf.RoundToInt(posy)].SetGridPos(Mathf.RoundToInt(posx), -Mathf.RoundToInt(posy), columns);
 }
Exemplo n.º 15
0
    //if the block above is durable -> chance of generating a candy block?
    //should the durable & candy blocks be generated?
    //if there is a durable block here, delete the generated block from here


    public void CreateBlock(int type, int row, int column)
    {
        //candy = type 1, block = type 2, durable block = type 3, level end block = type 4
        string typeS;

        if (type == 1)
        {
            typeS = "Candy";
        }
        else if (type == 2)
        {
            typeS = "Block";
        }
        else if (type == 3)
        {
            typeS = "Fluori";
        }
        else
        {
            typeS = "LvlEnd";
        }
        GameObject go;

        //configure candies
        if (type == 1)
        {
            go             = Instantiate(candyPrefab);
            blockScript    = go.GetComponent <BlockScript>();
            blockScript.bc = BlockColor.Candy;
            blockScript.bs = BlockState.Static;
        }
        else if (type == 3)
        {
            go = Instantiate(greyPrefab);
        }
        else
        {
            go = Instantiate(blockPrefab);
        }
        //for all types, change name and position
        go.name = (typeS + "_" + row + "_" + column).ToString();
        Vector2 newPosition = new Vector2(firstBlock.x + column, firstBlock.y - row);

        go.transform.position = newPosition;
        blockScript           = go.GetComponent <BlockScript>();

        //separate level end blocks from blocks and candies (why?)
        //configure level end blocks
        if (type < 4)
        {
            go.transform.parent = blockFolder;
        }
        else
        {
            go.transform.parent  = endBlocks;
            blockScript.bc       = BlockColor.LevelEnd;
            blockScript.bs       = BlockState.Static;
            blockScript.levelEnd = true;
        }
    }
Exemplo n.º 16
0
    public void entangle(BlockScript block)
    {
        Texture c = color == 1 ? red : color == 0 ? purple : blue;

        if (entangled != null && block == null)
        {
            BlockScript temp = entangled;
            entangled = null;
            if (temp.entangled != null)
            {
                temp.entangle(null);
            }
            c = color == 1 ? red : color == 0 ? purple : blue;
        }
        else if (block != null)
        {
            if (entangled && entangled.entangled != null)
            {
                entangled.entangle(null);
            }
            entangled = block;
            if (block.entangled != this)
            {
                block.entangle(this);
            }
            c = color == 1 ? red2 : color == 0 ? purple2 : blue2;
        }
        GetComponent <Renderer>().material.SetTexture("_EmissionMap", c);
    }
Exemplo n.º 17
0
    public void generatePhysicalShip(ShipChromosomeNode root)
    {
        GameObject g = (GameObject)GameObject.Instantiate(Resources.Load(Config.HEAVY_BLOCK_PREFAB_LOCATION),
                                                          Vector3.zero,
                                                          Quaternion.identity);

        Rigidbody r = g.AddComponent <Rigidbody>();

        r.mass        = Config.BLOCK_MASS * root.getListOfNodes().Count;
        r.drag        = Config.BLOCK_DRAG;
        r.angularDrag = Config.BLOCK_ANGULAR_DRAG;
        //r.constraints = RigidbodyConstraints.FreezeAll;
        r.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY
                        | RigidbodyConstraints.FreezePositionZ;

        BlockScript    b = g.GetComponent <BlockScript>();
        ShipController s = g.AddComponent <ShipController>();

        s.rootNode = root;
        s.setOrbs(orbsRoot);

        lastShip = s;

        b.initialize(root, s);
        b.combineSubMeshes();
        g.transform.position = transform.position;
        g.SetActive(false);
    }
Exemplo n.º 18
0
    BlockScript getBlock(int colorIndex)
    {
        BlockScript b = null;

        while (freeInPool < blocks.Count)
        {
            if (!blocks[freeInPool].gameObject.activeSelf)
            {
                b = blocks[freeInPool];
                break;
            }

            freeInPool++;
        }

        if (b == null)
        {
            b         = Instantiate <GameObject>(blockPrefab).GetComponent <BlockScript>();
            b.myIndex = blocks.Count;
            blocks.Add(b);
        }

        b.rendy.sharedMaterial = materials[colorIndex];
        b.myColor = colorIndex;
        b.gameObject.SetActive(true);

        return(b);
    }
Exemplo n.º 19
0
    void CreatePoolBlock(GameObject blockPrefab)
    {
        GameObject  newBlock       = Instantiate(blockPrefab, Vector3.one * 100, Quaternion.identity);
        BlockScript newBlockScript = newBlock.GetComponent <BlockScript>();

        pool.Add(newBlockScript);
    }
Exemplo n.º 20
0
    public bool CheckAlign()
    {
        bool aligned;

        float yRot = Block2.transform.localRotation.eulerAngles.y;

        if (yRot >= (360.0f - give) && yRot <= 360.0f || yRot >= 0.0f && yRot <= give)
        {
            // print ("Stopped spinning at " + Block2.transform.localRotation.eulerAngles.y);

            // StopCoroutine(SpinBlockRoutine);

            BlockScript cbs = CurBlock.GetComponent <BlockScript>();
            cbs.isSpinning = false;

            BlockScript pbs = PrevBlock.GetComponent <BlockScript>();

            cbs.ScaleAndMove(1.00f);

            pbs.ScaleAndMove(1.5f);

            StartCoroutine(SnapBlock(CurBlock));

            PrevBlock = CurBlock;

            // NextBlock ();

            return(true);
        }
        else
        {
            return(false);
        }
    }
Exemplo n.º 21
0
    void CreateJoint()
    {
        RaycastHit hitInfo;

        GetComponentInChildren <Collider>().enabled = false;
        if (Physics.Raycast(transform.position, -transform.up, out hitInfo, 1.0f))
        {
            if (hitInfo.collider.CompareTag("Block") || hitInfo.collider.CompareTag("Core"))
            {
                FixedJoint joint = gameObject.AddComponent <FixedJoint>();
                joint.connectedBody   = hitInfo.rigidbody;
                joint.connectedAnchor = hitInfo.transform.position;
                joint.anchor          = transform.position;
                joint.breakForce      = 900.0f;
                this.joint            = joint;

                FixedJoint jointHit = hitInfo.collider.gameObject.AddComponent <FixedJoint>();
                jointHit.connectedBody   = rb;
                jointHit.anchor          = hitInfo.transform.position;
                jointHit.connectedAnchor = transform.position;
                jointHit.breakForce      = 900.0f;
                BlockScript script = hitInfo.collider.gameObject.GetComponent <BlockScript>();
                if (script != null)
                {
                    script.AddJointToList(jointHit);
                }
            }
        }
        GetComponentInChildren <Collider>().enabled = true;
    }
Exemplo n.º 22
0
    void Merge(BlockScript blockInDir)
    {
        //print("merging " + this + " to " + blockInDir.group);
        int direction = blockInDir == blockLeft ? 1 : -1;

        if (blockInDir.bs == BlockState.Static)
        {
            //if (blockInDir.bs == BlockState.Static || blockInDir.bs == BlockState.Hold) {
            Vector3 placeToSnap = blockInDir.transform.position + new Vector3(direction, 0, 0);
            placeToSnap        = new Vector3(Mathf.Round(placeToSnap.x), Mathf.Round(placeToSnap.y), Mathf.Round(placeToSnap.z));
            transform.position = placeToSnap;
            bs = BlockState.Static;
        }
        var tempTime = blockBelow.holdTimer;

        foreach (BlockScript block in group)   //tästä oma funktio?
        {
            if (block.blockLeft)
            {
                tempTime = tempTime < block.blockBelow.holdTimer ? tempTime : block.blockLeft.holdTimer;
            }
        }
        foreach (BlockScript block in group)
        {
            block.holdTimer = tempTime;
        }

        bm.SetBlockInGrid(this);
        bs = blockInDir.bs;
        bsc.SpriteUpdate();
        //bm.MergeGroups(this, blockInDir);
    }
Exemplo n.º 23
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        print("collided");
        collided = true;
        if (collision.gameObject.tag.Equals("Player"))
        {
            print("GAME OVER");
            SceneManager.LoadScene("Death");
            //PlayerScript.Health -= 30;
        }
        else
        {
            BlockScript blockScript = collision.gameObject.GetComponent <BlockScript>();
            print(collision.gameObject);
            print(blockScript);
            if (blockScript != null)
            {
                currtarget = 0;
                int nearest = blockScript.GetNearestEdge(targets[2], transform);
                targets[0] = collision.gameObject.transform.GetChild(nearest / 10);
                targets[1] = collision.gameObject.transform.GetChild(nearest % 10);
                if (targets[0] == targets[1])
                {
                    currtarget = 1;
                }

                print(targets[0].parent.gameObject.name);
                print(targets[0].gameObject.name);
                print(targets[1].gameObject.name);
            }
            prioritizeY = !prioritizeY;
            rigidbody.MovePosition(rigidbody.position - movementVector);
        }
        //EnemyPosScript.UpdatePosition(index, transform.position);
    }
Exemplo n.º 24
0
    //Tenta colocar blocos de 4 ou 5 squares em uma posição aleatoria no grid
    void PlaceRandomBlocks()
    {
        Vector2 destiny = new Vector2(Random.Range(0, gridSize), Random.Range(0, gridSize));

        int        squaresNumber = Random.Range(4, 6);
        GameObject randomBlock   = GameManager.Instance.allBlocks[squaresNumber][Random.Range(0, GameManager.Instance.allBlocks[squaresNumber].Count)] as GameObject;
        GameObject blockGO       = (GameObject)Instantiate(randomBlock, SpawnScript.Instance.spawnLocations[GameManager.Instance.activeBlocks.Count].transform.position, Quaternion.identity);

        for (int rot = 0; rot < Random.Range(0, 4); rot++)
        {
            blockGO.GetComponent <BlockScript>().RotateBlock();
        }

        if (LogicManager.Instance.CheckPosition(blockGO, destiny))
        {
            blockGO.transform.parent = GameObject.Find("Blocks").transform;
            LogicManager.Instance.PlaceBlock(blockGO, destiny);
            BlockScript bs = blockGO.GetComponent <BlockScript>();
            bs.solutionPos             = destiny;
            bs.solutionIndex           = bs.rotIndex;
            blockGO.transform.position = SpawnScript.Instance.spawnLocations[bs.bNumber].transform.position - Vector3.forward;

            Debug.Log(blockGO.name + " posicionado em " + bs.solutionPos.x + "," + bs.solutionPos.y);
            string blockID = blockGO.name.Replace("(Clone)", "").Trim();
            sBlockList.Add(new SerializableBlock(blockID, squaresNumber, bs.solutionIndex, (int)bs.solutionPos.x, (int)bs.solutionPos.y));
        }
        else
        {
            GameManager.Instance.activeBlocks.Remove(blockGO);
            Destroy(blockGO);
        }
    }
Exemplo n.º 25
0
    void PaintGridPreview()
    {
        ClearGridColor();
        Vector2     closestGridLoc = new Vector2(Mathf.RoundToInt(transform.position.x), Mathf.RoundToInt(transform.position.y));
        Vector2     destiny        = closestGridLoc - (relativePos - parentBlock.rotPos[parentBlock.rotIndex]);
        BlockScript bs             = parentBlock.GetComponent <BlockScript>();

        foreach (BlockTile bTile in parentBlock.tileList)
        {
            Color   gridPreviewColor;
            Vector2 tilePos = destiny - (bs.rotPos[bs.rotIndex] - bTile.relativePos);
            if (tilePos.x >= 0 && tilePos.x < SpawnScript.Instance.gridSize && tilePos.y >= 0 && tilePos.y < SpawnScript.Instance.gridSize)
            {
                if (LogicManager.Instance.CheckPosition(parentBlock.gameObject, destiny))
                {
                    gridPreviewColor = new Color(0, 1, 0, 0.7f);
                }
                else
                {
                    gridPreviewColor = new Color(1, 0, 0, 0.7f);
                }

                gridGO[Mathf.RoundToInt(tilePos.x), Mathf.RoundToInt(tilePos.y)].GetComponent <SpriteRenderer>().color = gridPreviewColor;
            }
        }
        GridScript.Instance.FillGrid();
    }
Exemplo n.º 26
0
    private void GestureRecognizer_ManipulationUpdatedEvent(InteractionSourceKind source, Vector3 cumulativeDelta, Ray headRay)
    {
        Debug.Log("enter into updated");
        GameObject oCurrentGameObject = EventSystem.current.currentSelectedGameObject;

        if (oCurrentGameObject != null)
        {
            oBlockScript = oCurrentGameObject.GetComponent <BlockScript>();
            Debug.Log("got blockscript");
            if (oBlockScript != null)
            {
                //oBlockScript.startMove();
                //Debug.Log("start move called");
                oBlockScript.move();
                Debug.Log("move called");
            }
            else
            {
                Debug.Log("block script null");
            }
        }
        else
        {
            Debug.Log("current game object is null");
        }
    }
Exemplo n.º 27
0
    public void OnDragStart(BlockScript block)
    {
        draggedLinkers = new List <GameObject>();
        otherLinkers   = new List <GameObject>();

        foreach (Transform t in block.tilesParent.transform)
        {
            if (t.CompareTag("Linker"))
            {
                draggedLinkers.Add(t.gameObject);
            }
        }

        List <BlockScript> blocks = BlockManager.instance.LivingBlocks;

        foreach (BlockScript b in blocks)
        {
            if (b != null && b != block)
            {
                foreach (Transform t in b.tilesParent.transform)
                {
                    if (t.CompareTag("Linker"))
                    {
                        otherLinkers.Add(t.gameObject);
                    }
                }
            }
        }
    }
Exemplo n.º 28
0
 public Block(BlockScript bs)
 {
     pos     = new IVector3(bs.transform.position);
     indest  = bs.indest;
     no_weld = (from d in bs.no_weld select new IVector3(bs.transform.rotation * d)).ToList();
     shape   = new BlockShape(this);
     this.bs = bs;
 }
Exemplo n.º 29
0
 void MatchBlock(BlockScript block, float delay)
 {
     if (block != null)
     {
         //print("     " + block + " " + block.x + ", " + block.y);
         fxControllerScript.MatchBlock(block, gameControllerScript.matchDelay, delay);
     }
 }
Exemplo n.º 30
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.tag.Equals("BlockTag"))
     {
         BlockScript blockScript = other.gameObject.GetComponent <BlockScript>();
         blockScript.takeDamage();
     }
 }
Exemplo n.º 31
0
 public void SetBlock(int x, int y, int z, BlockScript block)
 {
     if (InRange(x) && InRange(y) && InRange(z))
     {
         blocks[x, y, z] = block;
     }
     else
     {
         world.SetBlock(pos.x + x, pos.y + y, pos.z + z, block);
     }
 }
Exemplo n.º 32
0
 // Use this for initialization
 void Start()
 {
     block = GetComponent<BlockScript>();
 }
Exemplo n.º 33
0
 protected override void Start()
 {
     collider.isTrigger = true;
     _block = transform.parent.parent.GetComponent<BlockScript>();
 }
Exemplo n.º 34
0
    public void SetBlock(int x, int y, int z, BlockScript block)
    {
        Chunk chunk = GetChunk(x, y, z);

        if (chunk != null)
        {
            chunk.SetBlock(x - chunk.pos.x, y - chunk.pos.y, z - chunk.pos.z, block);
            chunk.update = true;
        }
    }
Exemplo n.º 35
0
 public override bool IsSolid(BlockScript.Direction direction)
 {
     return false;
 }