Пример #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>();
 }