Esempio n. 1
0
    public void SelectPiece(Piece piece)
    {
        this.StopParticlesAnimation();

        foreach (Transform child in transform) {
            Behaviour otherHalo = child.gameObject.GetComponent("Halo") as Behaviour;
            if(otherHalo == null)
                continue;

            otherHalo.enabled = false;
        }

        Behaviour halo = piece.GetComponent("Halo") as Behaviour;
        halo.enabled = true;

        selectedObject = pieceObjects [piece.name];
        selectedPiece = piece;

        int[][] availablePositionList = selectedObject.GetAvailableListToGo ();

        for(int i = 0; i < availablePositionList.Length; i++){
            ParticleSystem pSystem = GameObject.Find ("light_" + availablePositionList[i][0] + "/" + availablePositionList[i][1])
                .GetComponentInChildren<ParticleSystem>();
            if(pSystem == null) continue;

            pSystem.Play();
        }
    }