public void SetType(NodeType nodeType, GameObject obj = null) { currentType?.RemoveNode(this); currentType = nodeType; roadDriveable = obj?.GetComponent <IDriveable>(); InvokeOnChangeType(); }
public ICarState ChangeEngineStatus(IDriveable driveable) { driveable.SetState(new StartState()); Console.WriteLine("Engine has started."); return(this); }
public string Deliver(IDriveable vehicle) { vehicle.Start(); vehicle.Accellerate(); vehicle.Steer(); vehicle.Decellerate(); vehicle.Stop(); return("Package was delivered"); }
//2 an interface could be beneficial when: //you have something that can be applied to many objects, ex. driveable //to ensure that any object created by another programmer will work with your code. //you want to obfuscate the implementation / create more abstraction. public static void Drive(IDriveable driveable) { driveable.StartEngine(); driveable.Gas(); driveable.Gas(); driveable.TurnLeft(); driveable.TurnRight(); driveable.TurnRight(); driveable.Break(); driveable.StopEngine(); }
public Stig(IDriveable whatImDriving) { WhatImDriving = whatImDriving; }
void OnEnable() { DrivingAction = GetComponent <IDriveable>(); }
public bool AddRacer(IDriveable racer) { Vehicles.Add(racer); return(true); }