47 lines
817 B
C#
47 lines
817 B
C#
using UnityEngine;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System;
|
|
|
|
[ExecuteInEditMode]
|
|
public class Starter : MonoBehaviour, IElectricDevice {
|
|
|
|
public bool started = false;
|
|
public BrushDcMotor motor;
|
|
public uint teethCount;
|
|
|
|
private PowerBus powerBus;
|
|
|
|
public string Name {
|
|
get { return "Starter"; }
|
|
}
|
|
|
|
public bool On {
|
|
get { return started; }
|
|
|
|
set {
|
|
started = value;
|
|
}
|
|
}
|
|
|
|
void FixedUpdate()
|
|
{
|
|
if (motor != null && started)
|
|
{
|
|
motor.Vin = 12.0;
|
|
}
|
|
else
|
|
{
|
|
motor.Vin = 0;
|
|
}
|
|
}
|
|
|
|
public string ShortDescription {
|
|
get { return "Starter"; }
|
|
}
|
|
|
|
public void SetPowerBus(PowerBus bus) {
|
|
powerBus = bus;
|
|
}
|
|
}
|