Inheritance: MonoBehaviour
コード例 #1
0
        static void Main(string[] args)
        {
            Vehicle vehicle = new Vehicle("Vehicle", "V1", 100, 10);

            StartVehicle(vehicle);
            StopVehicle(vehicle);
            VehicleV2 vehicleV2 = new VehicleV2("Vehicle", "V2", 120, 10);

            StartVehicle(vehicleV2);
            StopVehicle(vehicleV2);
            Car car = new Car("Chevrolet", "Spark", 120, 5, 4, CarType.Hatchback, TransmissionType.Manual);

            car.Start();
            car.Stop();
            Plane plane = new Plane("Boeing", "747", 500, 100, 10000, PlaneType.Commerical);

            plane.Start();
            plane.Stop();
            Boat boat = new Boat("I don't know boats", "Splish Splashy", 120, 10, BoatType.Yacht);

            boat.Start();
            boat.Stop();
            Hovercraft hovercraft = new Hovercraft("Rootem Scootem", "Dukem Nukem", 1000, 10);

            hovercraft.Start();
            hovercraft.Stop();
            Console.ReadLine();
        }
コード例 #2
0
 public override void ApplyZone(Hovercraft hovercraft)
 {
     hovercraft.DamageHealth(damagePerSecond * Time.deltaTime);
     hovercraft.Rb.AddForce(-hovercraft.Rb.velocity * hovercraft.Rb.velocity.magnitude * dragCoeff);
 }
コード例 #3
0
 private void Awake()
 {
     Hovercraft = GetComponent <Hovercraft>();
     instance   = this;
 }
コード例 #4
0
 // Start is called before the first frame update
 void Start()
 {
     playerHovercraft = PlayerInput.Instance.Hovercraft;
     StartCoroutine(UpdateRoutine());
 }
コード例 #5
0
 public override void ApplyZone(Hovercraft hovercraft)
 {
     hovercraft.Rb.AddForce(-hovercraft.Rb.velocity * hovercraft.Rb.velocity.magnitude * dragCoeff);
 }
コード例 #6
0
 public override void ApplyZone(Hovercraft hovercraft)
 {
     hovercraft.RestoreHealth(healsPerSecond * hovercraft.GetMaxHealth() * Time.deltaTime);
 }
コード例 #7
0
 public abstract void ApplyZone(Hovercraft hovercraft);
コード例 #8
0
 public override void ApplyZone(Hovercraft hovercraft)
 {
     hovercraft.Rb.AddForce(Vector3.up * jumpCoeff * hovercraft.Rb.velocity.magnitude * Physics.gravity.magnitude, ForceMode.Acceleration);
 }