Esempio n. 1
0
    void Start()
    {
        rb   = GetComponent <Rigidbody>();
        lipo = GetComponent <Lipo>();
        if (lipo == null)
        {
            lipo = GetComponentInChildren <Lipo>();
        }

        rb.maxAngularVelocity = 35;

        quadMesh = transform.GetChild(0);
        startPos = transform.position;
        startRot = transform.rotation;

        pidRoll  = new PID();
        pidPitch = new PID();
        pidYaw   = new PID();

        XDocument thrcur = XDocument.Parse(StaticDataAccess.config.fs.Read(ConfigManager.basePath + "thrcur.xml"));
        XDocument curthr = XDocument.Parse(StaticDataAccess.config.fs.Read(ConfigManager.basePath + "curthr.xml"));

        powertrain = new Powertrain();
        powertrain.throttleCurrentCurve.Deserialize(thrcur.Element("dataCurve"));
        powertrain.currentThrustCurve.Deserialize(curthr.Element("dataCurve"));
    }
Esempio n. 2
0
    protected override void Start()
    {
        rect = gameObject.GetComponent <RectTransform>();
        text = gameObject.AddComponent <Text>();
        GameObject[] copters = GameObject.FindGameObjectsWithTag("copter");
        if (copters.Length > 0)
        {
            lipo = copters[0].GetComponent <Lipo>();
            if (lipo == null)
            {
                lipo = copters[0].GetComponentInChildren <Lipo>();
            }
        }

        rect.anchorMin         = new Vector2(0.8f, 0.9f);
        rect.anchorMax         = new Vector2(0.98f, 1.0f);
        rect.offsetMin         = rect.offsetMax = Vector2.zero;
        rect.anchoredPosition  = Vector2.zero;
        rect.sizeDelta         = Vector2.zero;
        text.resizeTextMinSize = 15;
        text.resizeTextMaxSize = 40;
        text.fontSize          = 25;
        text.alignment         = TextAnchor.MiddleRight;
        text.font          = font;
        text.raycastTarget = false;
    }