Exemple #1
0
    private void ActivateCutDirection(Tile tile, float angle, int index)
    {
        CutDirectionButton newCutDirection = Instantiate(cutDirectionPrefab);

        newCutDirection.transform.SetParent(gameObject.transform, false);
        newCutDirection.transform.Rotate(new Vector3(0, 0, 1), angle);
        newCutDirection.SetCutDirection(CutDirectionButton.GetCutDirection(angle));

        newCutDirection.gameObject.transform.position = PointOnCircle(circleRadius, angle, gameObject.transform.position);
        UpdateCutDirectionValues(tile, newCutDirection);

        cutDirections.Add(newCutDirection);
    }
Exemple #2
0
    public static Note Instantiate(Note notePrefab, GameObject bombSpherePrefab, GameObject blueCubePrefab, GameObject redCubePrefab, Note.CutDirection cutDirection, Vector2Int coordinate, double time, Note.ItemType type, bool active = false)
    {
        Note note = GameObject.Instantiate(notePrefab);

        note.gameObject.transform.SetParent(GameObject.FindGameObjectWithTag("2DGrid").transform);
        if (CutDirectionButton.GetAngle(cutDirection).HasValue)
        {
            note.gameObject.transform.Rotate(Vector3.forward, CutDirectionButton.GetAngle(cutDirection).Value);
        }
        note.gameObject.transform.position = GridGenerator.Instance.Tiles[coordinate].gameObject.transform.position;
        note.Set(time, coordinate.x, coordinate.y, type, cutDirection);


        GameObject arrowCube = null;

        switch (type)
        {
        case Note.ItemType.Red:
            arrowCube = GameObject.Instantiate(redCubePrefab);
            break;

        case Note.ItemType.Blue:
            arrowCube = GameObject.Instantiate(blueCubePrefab);
            break;

        case Note.ItemType.Bomb:
            arrowCube = GameObject.Instantiate(bombSpherePrefab);
            break;

        default:
            break;
        }

        Vector2 arrowCubePos = _3DGridGenerator.Instance.GetCoordinatePosition(coordinate, arrowCube);

        arrowCube.transform.position = new Vector3(arrowCubePos.x, (float)_3DGridGenerator.Instance.GetBeatPosition(time), arrowCubePos.y);
        if (CutDirectionButton.GetAngle(cutDirection).HasValue)
        {
            arrowCube.transform.Rotate(Vector3.back, CutDirectionButton.GetAngle(cutDirection).Value);
        }
        arrowCube.transform.SetParent(GameObject.FindGameObjectWithTag("3DCanvas").transform, false);

        arrowCube.SetActive(false);
        note.arrowCube = arrowCube;
        note.gameObject.SetActive(active);

        return(note);
    }
Exemple #3
0
 private void UpdateCutDirectionValues(Tile tile, CutDirectionButton cutDirection)
 {
     cutDirection.tileParent = tile;
     cutDirection.GetComponent <Image>().color = MapEditorManager.Instance.ItemType == Note.ItemType.Red ? Color.red : Color.blue;
 }