// Use this for initialization
 void Start()
 {
     //charger = GetComponent<ChargerServer>();
     variables       = GetComponent <VariableScheduler>();
     height          = new Vector3(0.0f, transform.position.y, 0.0f);
     currentPosition = transform.position - height;
     vectors.Add(currentPosition);
     rb        = GetComponent <Rigidbody>();
     speed     = variables.getMinSpeed();
     maxSpeed  = variables.getMaxSpeed();
     hour      = 0.0f;
     min       = 0.0f;
     sec       = 0.0f;
     esc       = 0.0f;
     isMoving  = false;
     escPar    = variables.getESC();
     moment    = variables.getMinSpeed();
     diffTime  = 0.0f;
     otherTime = System.DateTime.Now;
     wholeTime.Add(System.DateTime.Now);
     wholeTime.Add(System.DateTime.Now);
     Power();
     PowerInput();
     curPowerPercent = (curPower / (power * (60 * 60))) * 100;
 }
    void PowerInput()
    {
        float F       = (variables.getMotorPower() * 0.9f * 1000) / variables.getMaxSpeed(); // mN
        float minTime = power / (variables.getMotorPower() * 1000);
        float P       = F * speed;                                                           //felvett teljesítmény mW-ban

        if ((P > 0) && isMoving)
        {
            curPower       -= P;
            curPowerPercent = (curPower / (power * (60 * 60))) * 100;
        }
        if (curPowerPercent < 0.0f)
        {
            curPowerPercent = 0.0f;
        }
        //print("power: "+power+" F:" + F + " P: " + P + " curPower: " + curPower);
    }
Esempio n. 3
0
 // Use this for initialization
 void Start()
 {
     //charger = GetComponent<ChargerServer>();
     variables = GetComponent<VariableScheduler>();
     height = new Vector3(0.0f, transform.position.y, 0.0f);
     currentPosition = transform.position - height;
     vectors.Add(currentPosition);
     rb = GetComponent<Rigidbody>();
     speed = variables.getMinSpeed();
     maxSpeed = variables.getMaxSpeed();
     hour = 0.0f;
     min = 0.0f;
     sec = 0.0f;
     esc = 0.0f;
     isMoving = false;
     escPar = variables.getESC();
     moment = variables.getMinSpeed();
     diffTime = 0.0f;
     otherTime = System.DateTime.Now;
     wholeTime.Add(System.DateTime.Now);
     wholeTime.Add(System.DateTime.Now);
     Power();
     PowerInput();
     curPowerPercent = (curPower / (power * (60 * 60))) * 100;
 }