Esempio n. 1
0
 private void Update()
 {
     if (LevelManager.GetCar().Physics.LinearVelocity.magnitude > this.speed)
     {
         AutograderManager.CompleteTask(this);
     }
 }
    private void OnTriggerEnter(Collider other)
    {
        Racecar racecar = other.GetComponentInParent <Racecar>();

        if (racecar != null)
        {
            AutograderManager.CompleteTask(this);
        }
    }
Esempio n. 3
0
    private void Update()
    {
        // Reset angle and distance so they are recalculated this frame
        this.angle    = null;
        this.distance = null;

        if (this.autograderTask == null)
        {
            LevelManager.ShowMessage($"Angle: {this.Angle:F1} degrees\nDistance: {this.Distance:F1} cm", this.IsSuccess ? Color.green : Color.white, -1);
        }
        else if (this.IsSuccess && LevelManager.GetCar().Physics.LinearVelocity.magnitude < Constants.MaxStopSeed)
        {
            // TODO: Find a way to display Angle and Distance
            AutograderManager.CompleteTask(this.autograderTask);
        }
    }
Esempio n. 4
0
    protected override void Update()
    {
        base.Update();

        if (Mathf.Abs(this.Distance - this.goalDistance) < this.allowableDistanceError)
        {
            this.text.color = Color.green;
            if (LevelManager.GetCar().Physics.LinearVelocity.magnitude < Constants.MaxStopSeed)
            {
                // The autograder task must be stored as a separate script due to the inheritance structure
                AutograderManager.CompleteTask(this.GetComponent <AutograderTask>());
            }
        }
        else
        {
            this.text.color = Color.white;
        }
    }
    private void OnTriggerStay(Collider other)
    {
        Racecar racecar = other.GetComponentInParent <Racecar>();

        if (racecar != null)
        {
            if (racecar.Physics.LinearVelocity.magnitude < this.maxStopSpeed)
            {
                this.startTime = Mathf.Min(this.startTime, Time.time);
                if (Time.time - this.startTime >= DestinationStop.stopDuration)
                {
                    AutograderManager.CompleteTask(this);
                }
            }
            else
            {
                this.startTime = float.MaxValue;
            }

            this.material.color = new Color(this.material.color.r, this.material.color.g, this.material.color.b, this.Alapha);
        }
    }