示例#1
0
    public override void OnWagonActivate(Wagon wagon, ActivateInfo info)
    {
        var loco = wagon.GetComponent <LocomotiveController>();

        if (loco != null)
        {
            DeactivateLocomotiveGlow();
            locomotive = loco;
            var glow = locomotive.GetComponent <GlowObject>();
            glow.ActivateGlow();
            speedSlider.value = Mathf.Round(locomotive.targetSpeed) / multiplier;
        }
    }
示例#2
0
    public override void OnTrackHover(TrackSectionComponent track, ActivateInfo info)
    {
        if (selectedWagon != null)
        {
            float distance;
            // TODO: Draw ghost instead
            var matrix = Matrix4x4.TRS(GetSnappedTrackPosition(track.trackSection, info.hit.point, out distance),
                                       track.trackSection.GetRotationOnTrack(distance),
                                       Vector3.one);

            Highlighter.DrawHighlighter(matrix);

            Graphics.DrawMesh(selectedWagon.GetComponent <MeshFilter>().sharedMesh, matrix, selectedWagon.GetComponent <MeshRenderer>().sharedMaterial, gameObject.layer);
        }
    }