コード例 #1
0
ファイル: Node.cs プロジェクト: Rohirrim/CrazyTrafficJam
 public void SetType(NodeType nodeType, GameObject obj = null)
 {
     currentType?.RemoveNode(this);
     currentType   = nodeType;
     roadDriveable = obj?.GetComponent <IDriveable>();
     InvokeOnChangeType();
 }
コード例 #2
0
        public ICarState ChangeEngineStatus(IDriveable driveable)
        {
            driveable.SetState(new StartState());
            Console.WriteLine("Engine has started.");

            return(this);
        }
コード例 #3
0
 public string Deliver(IDriveable vehicle)
 {
     vehicle.Start();
     vehicle.Accellerate();
     vehicle.Steer();
     vehicle.Decellerate();
     vehicle.Stop();
     return("Package was delivered");
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: Roflcoffel/csharp_basics
 //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();
 }
コード例 #5
0
ファイル: Stig.cs プロジェクト: seanjacob/seanjacob_Projects
 public Stig(IDriveable whatImDriving)
 {
     WhatImDriving = whatImDriving;
 }
コード例 #6
0
ファイル: Stig.cs プロジェクト: seanjacob/seanjacob_Projects
 public Stig(IDriveable whatImDriving)
 {
     WhatImDriving = whatImDriving;
 }
コード例 #7
0
ファイル: Driving.cs プロジェクト: Olaph27/Olaf
 void OnEnable()
 {
     DrivingAction = GetComponent <IDriveable>();
 }
コード例 #8
0
 public bool AddRacer(IDriveable racer)
 {
     Vehicles.Add(racer);
     return(true);
 }