예제 #1
0
        public void Init()
        {
            // With substitute.for we create a mock for the IRobotActuator interface.
            _robotActuator = Substitute.For <IRobotActuator>();

            // Because we cannot use time inside unit tests, we need to mock the timer class also
            _timer = Substitute.For <ITimer>();

            // Then we can pass this mock to the robotbattery so that it is not depended on the robotactuator and the timer itself.
            _robotBattery = new RobotBattery(_robotActuator, _timer);
        }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        seconds   = 0;
        resetting = false;
        battery   = GetComponent <RobotBattery>();
        flip      = GetComponent <RobotReset>();
        InvokeRepeating("Blink", 0, 0.5f);
        initialPosition = gameObject.transform.position;
        initialRotation = gameObject.transform.rotation;

        GetComponent <Rigidbody>().maxAngularVelocity = 1.5f;
    }
예제 #3
0
    void Start()
    {
        IskeiroHealth  = Iskeiro.GetComponent <RobotHealth>();
        DarcHealth     = darc.GetComponent <RobotHealth>();
        DarcBattery    = darc.GetComponent <RobotBattery>();
        IskeiroBattery = Iskeiro.GetComponent <RobotBattery>();

        WinnerName = WinText.GetComponent <Text>();
        GameTimer  = Canvas.GetComponent <Timer>();

        audioExcellent  = GetComponent <AudioSource>();
        audioImpressive = GetComponent <AudioSource>();
        audioWellDone   = GetComponent <AudioSource>();

        robotControllerIskeiro = Iskeiro.GetComponent <RobotController>();
        robotControllerDarc    = darc.GetComponent <RobotController>();

        resetting = false;
    }
예제 #4
0
    // Update is called once per frame
    void Update()
    {
        //Hide the display if no robot is selected
        if (levelManager.currentRobot == null)
        {
            canvasGroup.alpha = 0.0f;
            return;
        }
        else
        {
            canvasGroup.alpha = 1.0f;
        }

        //Get the battery of the current robot
        RobotBattery battery = levelManager.currentRobot.battery;

        //incase the current robot has changed
        maxBattery = battery.max;

        //Get level
        CurrentBattery = battery.level;
    }
예제 #5
0
 // Use this for initialization
 void Start()
 {
     seconds = 0;
     battery = GetComponent <RobotBattery>();
 }
예제 #6
0
 // Use this for initialization
 void Start()
 {
     weapon          = GetComponent <HingeJoint>();
     weapon.useMotor = true;
     battery         = robot.GetComponent <RobotBattery>();
 }