void Start()
    {
        // Cache camera
        mainCamera = Camera.main;

        // Parent the particle system to the main camera
        particles.particleSystemTransform.parent         = mainCamera.transform;
        particles.shurikenParticleSystem.simulationSpace = ParticleSystemSimulationSpace.Local;

        // Create a new spline and set it up
        spline      = new GameObject("Viewport Spline", typeof(PlaygroundSpline)).GetComponent <PlaygroundSpline>();
        spline.Loop = true;
        spline.Reset();
        spline.SetControlPointMode(0, BezierControlPointMode.Free);
        spline.SetControlPointMode(1, BezierControlPointMode.Free);

        // Add three additional nodes (a basic spline will contain two initial nodes)
        spline.AddNode();
        spline.AddNode();
        spline.AddNode();

        // Set the nodes to match the viewport
        currentScreenX = Screen.width;
        currentScreenY = Screen.height;
        SetViewportNodes();

        // Assign the spline to the particle system
        particles.splines.Add(spline);

        // Make sure we're using the spline as source
        particles.source = SOURCEC.Spline;

        prevScreenOffset = screenOffset;
    }
    void OnEnable()
    {
        spline = target as PlaygroundSpline;

        playgroundSettings = PlaygroundSettingsC.GetReference();
        playgroundLanguage = PlaygroundSettingsC.GetLanguage();

        lastActiveTool = UnityEditor.Tools.current;

        UpdateUserList();
    }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        boxCollider  = GetComponent <BoxCollider>();
        player       = GameObject.FindGameObjectWithTag("Player");
        selectionBox = Menu.selectionBox;
        placed       = selectionBox.activeInHierarchy;
        removed      = selectionBox.activeInHierarchy;

        spline = GetComponentInChildren <PlaygroundSpline>();
        pos    = 1;

        brush       = this.transform.GetComponent <BrushBehaviour>();
        brushPlayer = GameObject.Find(brush.PlayerID).transform.GetComponent <PlayerBehaviour>();
    }