Example #1
0
    //----------------------------------------------------------------------------------------------
    // 更新処理
    //----------------------------------------------------------------------------------------------
    public override void OnUpdate(AutoPilot ap)
    {
        // 攻撃
        int energy = ap.GetEnergy();

        if (energy > 15 && Input.GetMouseButton(0))
        {
            ap.StartAction("ATK1", -1);
        }
        else
        {
            ap.EndAction("ATK1");
        }
        if (energy > 30 && Input.GetMouseButton(1))
        {
            ap.StartAction("ATK3", -1);
        }
        else
        {
            ap.EndAction("ATK3");
        }
        if (!missile && energy > 15 && Input.GetMouseButtonDown(2))
        {
            ap.StartAction("ATK2", -1);
            missile = true;
        }
        else if ((missile && Input.GetMouseButtonDown(2)) || energy < 10)
        {
            ap.EndAction("ATK2");
            missile = false;
        }
    }
Example #2
0
 //----------------------------------------------------------------------------------------------
 // 開始処理
 //----------------------------------------------------------------------------------------------
 public override void OnStart(AutoPilot ap)
 {
     jetPower = 0;
     autoAim  = false;
     bit      = false;
     scope    = 0;
 }
Example #3
0
        static void Main(string[] args)
        {
            VTDGen vg = new VTDGen();
            int i;
            AutoPilot ap = new AutoPilot();
            ap.selectXPath("/CATALOG/CD[PRICE < 10]");
            BookMark bm = new BookMark();
            if (vg.parseFile("cd.xml", false))
            {
                VTDNav vn = vg.getNav();
                bm.bind(vn);
                ap.bind(vn);

                //XPath eval returns one node at a time
                while ((i = ap.evalXPath()) != -1)
                {
                    // push the current cursor position
                    //vn.push();
                    bm.recordCursorPosition(); // equivalent to vn.push();
                    // get to the first child
                    if (vn.toElement(VTDNav.FIRST_CHILD, "TITLE"))
                    {
                        int j = vn.getText();
                        if (j != -1)
                            Console.WriteLine(" text node ==>" + vn.toString(j));
                    }
                    // restore the cursor position
                    //vn.pop(); 
                    bm.setCursorPosition(); // equivalent to vn.pop();
                }
                ap.resetXPath();
            }
        }
Example #4
0
    public EnemyLockRadar(AutoPilot ap, float dScrn, float radarScale, Vector2 radarOffsetDef, Vector2 radarWindow, MenuLib menu)
    {
        string back;
        int    numBack;

        this.ap             = ap;
        this.dScrn          = dScrn;
        this.radarScale     = radarScale;
        this.radarOffsetDef = radarOffsetDef;
        this.radarWindow    = radarWindow;
        radarOffset         = radarOffsetDef;
        Util = new UtilityLib(ap, dScrn);
        Scan = new ScanLib(ap, dScrn);
        Lock = new LockOnLib(ap, dScrn);
        Key  = new KeybindLib(ap);
        Menu = menu;
        Rad  = new RadarLib(ap, dScrn, radarOffset, radarScale, radarWindow);

        List <SubMenu> RadarMenu = new List <SubMenu>();

        back = "MainMenu"; numBack = 0;
        RadarMenu.Add(new SubMenu("Radar Scale", 1, numBack, back, "", 0.15f, 0.001f, 0.5f, 0f));
        RadarMenu.Add(new SubMenu("Radar X", 1, numBack, back, "", 0f, 10f, 0.5f));
        RadarMenu.Add(new SubMenu("Radar Y", 1, numBack, back, "", 0f, 10f, 0.5f));
        Menu.MenuAdd("RadarMenu", RadarMenu);

        List <SubMenu> LockOnMenu = new List <SubMenu>();

        back = "MainMenu"; numBack = 1;
        LockOnMenu.Add(new SubMenu("LockOnStat", 2, numBack, back, "", false));
        LockOnMenu.Add(new SubMenu("X", 0, numBack, back, ""));
        LockOnMenu.Add(new SubMenu("Y", 0, numBack, back, ""));
        LockOnMenu.Add(new SubMenu("Z", 0, numBack, back, ""));
        Menu.MenuAdd("LockOnMenu", LockOnMenu);
    }
Example #5
0
    //----------------------------------------------------------------------------------------------
    // 更新処理
    //----------------------------------------------------------------------------------------------
    public override void OnUpdate(AutoPilot ap)
    {
        /// 左クリックでスプライト追加
        if (Input.GetKeyDown(KeyCode.Mouse0))
        {
            util.AddSprite(ap);
        }

        /// 右クリックでスプライト削除
        if (Input.GetKeyDown(KeyCode.Mouse1))
        {
            util.RemoveSprite(ap);
        }

        // 全スプライト移動
        util.MoveSprites(ap);

        // スプライトが無い場合のみライン描画
        int spriteCount = util.GetSpriteCount();

        if (spriteCount == 0)
        {
            Util2.DrawLines(ap);
        }
        ap.Print(0, "SpriteCount=" + spriteCount);
    }
Example #6
0
    //----------------------------------------------------------------------------------------------
    // 更新処理
    //----------------------------------------------------------------------------------------------
    public override void OnUpdate(AutoPilot ap)
    {
        // 敵選択(0.5秒以上押し続けると解除)
        ap.SelectEnemy(KeyCode.Mouse1);

        // エナジーが10%未満になったら捕捉を中止する
        if (ap.GetEnergy() < 10)
        {
            ap.ForgetEnemy();
        }

        // 情報取得&表示
        float dist = ap.GetEnemyDistance();

        ap.Print(0, "Enemy : " + ap.GetEnemyName());
        ap.Print(1, "Distance : " + dist);

        // 選択中の敵が600m以内ならエイミング
        if (dist < 600f)
        {
            Vector3 relVel = ap.GetEnemyVelocity() - ap.GetVelocity() * 0.5f;                   // 相対速度
            Vector3 estPos = ap.GetEnemyPosition() + relVel * dist * 0.006f;                    // 着弾予測座標
            ap.Aim(estPos);

            // 選択中の敵が500m以内なら射撃アクション実行
            if (dist < 500f)
            {
                ap.StartAction("CannonA", 1);
            }
        }
    }
Example #7
0
        public static void Main(String[] args)
        {
            // instantiate VTDGen and XMLModifier
            VTDGen      vg  = new VTDGen();
            XMLModifier xm  = new XMLModifier();
            AutoPilot   ap  = new AutoPilot();
            AutoPilot   ap2 = new AutoPilot();

            ap.selectXPath("(/*/*/*)[position()>1 and position()<4]");
            ap2.selectXPath("/*/*/*");
            if (vg.parseFile("soap2.xml", true))
            {
                VTDNav vn = vg.getNav();
                xm.bind(vn);
                ap2.bind(vn);
                ap.bind(vn);
                ap2.evalXPath();
                ElementFragmentNs ef = vn.getElementFragmentNs();
                int i = -1;
                while ((i = ap.evalXPath()) != -1)
                {
                    xm.insertAfterElement(ef);
                }
                xm.output("new_soap.xml");
            }
        }
    private void Awake()
    {
        aiPilot                        = GetComponent <AIPilot>();
        autoPilot                      = aiPilot.autoPilot;
        Networker.PlaneUpdate         += PlaneUpdate;
        Networker.WeaponSet_Result    += WeaponSet_Result;
        Networker.Disconnecting       += OnDisconnect;
        Networker.WeaponFiring        += WeaponFiring;
        Networker.WeaponStoppedFiring += WeaponStoppedFiring;

        weaponManager = GetComponent <WeaponManager>();
        if (weaponManager == null)
        {
            Debug.LogError("Weapon Manager was null on " + gameObject.name);
        }
        cmManager = GetComponentInChildren <CountermeasureManager>();
        if (cmManager == null)
        {
            Debug.LogError("CountermeasureManager was null on " + gameObject.name);
        }
        fuelTank = GetComponent <FuelTank>();
        if (fuelTank == null)
        {
            Debug.LogError("FuelTank was null on " + gameObject.name);
        }

        traverse = Traverse.Create(weaponManager);
    }
Example #9
0
 static void Main(string[] args)
 {
     try
     {
         // open a file and read the content into a byte array
         VTDGen vg = new VTDGen();
         if (vg.parseFile("./servers.xml", true))
         {
             VTDNav    vn = vg.getNav();
             AutoPilot ap = new AutoPilot(vn);
             ap.selectElementNS("http://purl.org/dc/elements/1.1/", "*"); // select name space here; * matches any local name
             int count = 0;
             while (ap.iterate())
             {
                 Console.Write("" + vn.getCurrentIndex() + "  ");
                 Console.WriteLine("Element name ==> " + vn.toString(vn.getCurrentIndex()));
                 int t = vn.getText(); // get the index of the text (char data or CDATA)
                 if (t != -1)
                 {
                     Console.WriteLine(" Text  ==> " + vn.toNormalizedString(t));
                 }
                 Console.WriteLine("\n ============================== ");
                 count++;
             }
             Console.WriteLine("Total # of element " + count);
         }
     }
     catch (NavException e)
     {
         Console.WriteLine(" Exception during navigation " + e);
     }
 }
Example #10
0
    /// スプライト移動
    public void MoveSprites(AutoPilot ap)
    {
        // スプライトが無い場合は情報表示をクリアして終了
        if (sprites.Count == 0)
        {
            ap.Print(1);
            ap.Print(2);
            return;
        }

        float time = Time.realtimeSinceStartup;         // 経過時間(秒)

        for (int i = 0; i < sprites.Count; ++i)
        {
            var     spriteRT = sprites[i].GetComponent <RectTransform>(); // スプライトのUIトランスフォーム取得
            Vector2 spritePos;
            float   modTime = time + i;                                   // 重ならないようにずらす
            spritePos.x = Mathf.Cos(modTime) * 640;                       // 論理画面幅(1280)の半分
            spritePos.y = Mathf.Sin(modTime) * 360;                       // 論理画面高さ(720)の半分
            spriteRT.anchoredPosition = spritePos;
            float spriteRot = Mathf.Repeat(time * 100, 360f);             // 回転角(度)
            spriteRT.localEulerAngles = Vector3.forward * spriteRot;      // Z軸まわりに回転

            /// 最初のスプライトに関する情報を表示
            if (i == 0)
            {
                ap.Print(1, "pos=" + spritePos);
                ap.Print(2, "rot=" + spriteRot);
            }
        }
    }
Example #11
0
    public override void OnStart(AutoPilot ap)
    {
        isRotateByMouse = false;
        IsPushedAlpha1  = false;
        isAiming        = false;
        IsboostMode     = false;
        RancherMode     = false;
        Aiming          = false;
        AimingOpt       = false;
        IsSGMode        = false;
        IsPushedF       = false;
        IsPushedKeyPad5 = false;
        IsPushedT       = false;
        IsPushedKeypad4 = false;
        PushedTab       = false;
        Counter         = 0;
        ChangeAim       = true;
        SavedVelocity   = Vector3.zero;
        //armoriserHUD = new ArmoriserHUD();
        if (ap.GetSurvivalRate("CheckWep") != 0)
        {
            ap.StartAction("FixedArm", -1);
        }

        ReadAssignFile(ap);
    }
Example #12
0
    public void CanvasMake(AutoPilot ap)
    {
        float smoothFactor = 7.0f;
        int   speed        = Convert.ToInt32(ap.GetSpeed());

        List <string> textlist = new List <string>();

        textlist.Add("|Menu|");
        textlist.Add("|Name : " + ap.GetMachineName() + "|");
        textlist.Add("|Speed : " + speed + "|");
        textlist.Add("|Lights : " + HeadLights + "|");
        textlist.Add(gameObject.name);
        // textlist.Add("HEEH");

        string textComp = "";

        for (int i = 0; i < textlist.Count; i++)
        {
            if (i != 0)
            {
                textComp = textComp + "\n";
            }
            textComp = textComp + textlist[i];
        }
        t.text = textComp;

        Vector3 tester = new Vector3(50, Screen.height - 100, -500);

        // Vector3 tester = ap.GetPosition()+new Vector3(0,20,0);
        g2.transform.position = tester;
        // g2.transform.LookAt(g2.transform.position + ap.GetCameraForward());
        g2.transform.LookAt(new Vector3(90, Screen.height - 100, -400));
        // cs.scaleFactor = 1.0f +(Time.frameCount % 20)/10;
        t.fontSize = 11;
    }
    static bool Prefix(AutoPilot __instance)
    {
        if (CheesesAITweaks.settings.controlNoiseEnabled)
        {
            if (CheesesAITweaks.apToHelper.ContainsKey(__instance))
            {
                CheeseAIHelper helper = CheesesAITweaks.apToHelper[__instance];

                Traverse apTraverse = new Traverse(__instance);
                helper.lastAimTarget  = __instance.targetPosition;
                helper.lastRollTarget = apTraverse.Field("overrideRollTarget").GetValue <Vector3>();
                if (helper.CanApplyNoise())
                {
                    Vector3 output = helper.GetControlNoise();
                    __instance.targetPosition += output * (__instance.targetPosition - __instance.referenceTransform.position).magnitude;
                    apTraverse.Field("overrideRollTarget").SetValue(helper.lastRollTarget + output * helper.lastRollTarget.magnitude);

                    float outputThrottle = apTraverse.Field("outputThrottle").GetValue <float>() + helper.GetThottleNoise();
                    if (__instance.controlThrottle)
                    {
                        foreach (ModuleEngine moduleEngine in __instance.engines)
                        {
                            moduleEngine.SetThrottle(outputThrottle);
                        }
                    }
                }
            }
        }
        return(true);
    }
Example #14
0
    public void CanvasTest(AutoPilot ap)
    {
        Canvas canvas = g.AddComponent <Canvas>();

        canvas.renderMode = RenderMode.ScreenSpaceCamera;
        //WorldSpace ScreenSpaceCamera
        cs                      = g.AddComponent <CanvasScaler>();
        cs.scaleFactor          = 1.0f;
        cs.dynamicPixelsPerUnit = 30f;
        // GraphicRaycaster gr = g.AddComponent<GraphicRaycaster>();
        t                    = g2.AddComponent <Text>();
        g2.name              = "Text";
        g2.transform.parent  = g.transform;
        t.alignment          = TextAnchor.UpperLeft;
        t.horizontalOverflow = HorizontalWrapMode.Overflow;
        t.verticalOverflow   = VerticalWrapMode.Overflow;
        Font ArialFont = (Font)Resources.GetBuiltinResource(typeof(Font), "Arial.ttf");

        t.font     = ArialFont;
        t.fontSize = 20;
        t.enabled  = true;
        t.color    = Color.black;
        g.GetComponent <RectTransform>().SetParent(g.transform, true);
        g.transform.localScale = new Vector3(1.0f / this.transform.localScale.x * 0.1f,
                                             1.0f / this.transform.localScale.y * 0.1f,
                                             1.0f / this.transform.localScale.z * 0.1f);
    }
Example #15
0
        static void Main(string[] args)
        {
            VTDGen vg = new VTDGen();
            int    i;

            if (vg.parseFile("po.xml", true))
            {
                // instantiate a node recorder here
                NodeRecorder nr = new NodeRecorder();
                AutoPilot    ap = new AutoPilot();
                VTDNav       vn = vg.getNav();
                ap.bind(vn);
                // bind node recorder to vn
                nr.bind(vn);
                ap.selectXPath("(/*/*/*)[position()=1 or position()=10]");
                while ((i = ap.evalXPath()) != -1)
                {
                    nr.record();   // save the selected nodes into nr
                }
                ap.resetXPath();   // a good practice
                nr.resetPointer(); // get into nr's read mode
                // iterating over the nodes recorded by nr
                while ((i = nr.iterate()) != -1)
                {
                    Console.WriteLine("string ==>" + vn.toString(i));
                }

                nr.clear(); //remove all the nodes in nr, buffer is however reused
            }
        }
Example #16
0
        static void Main(string[] args)
        {
            VTDGen    vg = new VTDGen();
            AutoPilot ap = new AutoPilot();
            Encoding  eg = System.Text.Encoding.GetEncoding("utf-8");
            //ap.selectXPath("/*/*/*");
            AutoPilot ap2 = new AutoPilot();

            ap2.selectXPath("//@*");
            if (vg.parseFile("soap2.xml", true))
            {
                FileStream fs = new FileStream("output.xml", System.IO.FileMode.OpenOrCreate);
                VTDNav     vn = vg.getNav();
                ap.bind(vn);
                ap2.bind(vn);
                //ap.evalXPath();
                int i;
                while ((i = ap2.evalXPath()) != -1)
                {
                    //System.out.println("attr name ---> "+ i+ " "+vn.toString(i)+"  value ---> "+vn.toString(i+1));
                    vn.overWrite(i + 1, eg.GetBytes(""));
                }
                byte[] ba = vn.getXML().getBytes();
                fs.Write(ba, 0, ba.Length);
                fs.Close();
            }
        }
Example #17
0
 //----------------------------------------------------------------------------------------------
 // 開始処理
 //----------------------------------------------------------------------------------------------
 public override void OnStart(AutoPilot ap)
 {
     missile     = false;
     sword       = false;
     spin        = false;
     missileMode = 1;
 }
Example #18
0
    public override void OnStart(AutoPilot ap)//�J�n���Ɉ����s
    {
        UtilityLib     Util;
        ScanLib        Scan;
        LockOnLib      Lock;
        RadarLib       Rad;
        KeybindLib     Key;
        MenuLib        Menu;
        EnemyLockRadar ELR;
        //Common Things
        Vector3 botPos;
        Vector3 botVel;
        float   botDir;
        float   botSpeed;

        float dScrn = Screen.height / 10;

        Util = new UtilityLib(ap, dScrn);
        Key  = new KeybindLib(ap);
        Menu = new MenuLib(ap);
        ap.SetAimTolerance(20);
        ap.SetLogicalScreenHeight(Screen.height);
        lastdistance = new List <Vector3>();
        AntiDuplicate();
        CanvasTest(ap);
        TrailStart(ap);
        // trailRend.enabled = true;

        this.mcnTf = ap.transform.parent;
        foreach (Transform c in mcnTf)
        {
            if ((this.coreTf = c.Find("Core")) != null)
            {
                break;
            }
        }

        headLightL = createHeadLight();
        headLightL.transform.localPosition = new Vector3(1f, 4f, 6.0f);
        headLightL.transform.localRotation = Quaternion.Euler(20, 0, 0);

        headLightR = createHeadLight();
        headLightR.transform.localPosition = new Vector3(-1f, 4f, 6.0f);
        headLightR.transform.localRotation = Quaternion.Euler(20, 0, 0);

        GameObject[] selfObj = GameObject.FindGameObjectsWithTag("self");
        layerMask = 0; // int layerMask; �Ƃ���OnStart()�̊O�Ő錾���Ă���
        foreach (GameObject obj in selfObj)
        {
            int l = 1 << obj.layer;
            layerMask = layerMask | l;
            for (int i = 0; i < obj.transform.childCount; i++)
            {
                l         = 1 << obj.transform.GetChild(i).gameObject.layer;
                layerMask = layerMask | l;
            }
        }
        layerMask = ~layerMask;
    }
Example #19
0
 //----------------------------------------------------------------------------------------------
 // 開始処理
 //----------------------------------------------------------------------------------------------
 public override void OnStart(AutoPilot ap)
 {
     missile     = false;
     fixFlg      = false;
     camCount    = 0;
     missileMode = 1;
     fireCount   = FIRE_COUNT_MAX;
 }
Example #20
0
    public Vector3 PosEstimate(AutoPilot ap, Vector3 origin, Vector3 target, Vector3 originVelocity, Vector3 targetVelocity, float speed)
    {
        Vector3 RelPos = target - origin;
        Vector3 RelVel = targetVelocity - originVelocity;
        float   time   = ReachTime(speed, RelPos, RelVel);

        return(target + RelVel * time);
    }
Example #21
0
        public static void Main(String[] args)
        {
            VTDGen    vg  = new VTDGen();
            AutoPilot ap0 = new AutoPilot();
            AutoPilot ap1 = new AutoPilot();
            AutoPilot ap2 = new AutoPilot();

            ap0.selectXPath("/root/a");
            ap1.selectXPath("/root/b");
            ap2.selectXPath("/root/c");
            Encoding eg = System.Text.Encoding.GetEncoding("utf-8");

            if (vg.parseFile("old.xml", false))
            {
                VTDNav vn = vg.getNav();
                ap0.bind(vn);
                ap1.bind(vn);
                ap2.bind(vn);
                FileStream fos = new FileStream("new.xml", System.IO.FileMode.OpenOrCreate);
                //fos.Write("<root>".getBytes());
                byte[] ba0, ba1, ba2, ba3, ba4;
                //ba0 = eg.GetBytes("
                ba1 = eg.GetBytes("<root>");
                ba2 = eg.GetBytes("</root>");
                ba3 = eg.GetBytes("\n");
                fos.Write(ba1, 0, ba1.Length);
                byte[] ba = vn.getXML().getBytes();
                while (ap0.evalXPath() != -1)
                {
                    long l      = vn.getElementFragment();
                    int  offset = (int)l;
                    int  len    = (int)(l >> 32);
                    fos.Write(ba3, 0, ba3.Length);
                    fos.Write(ba, offset, len);
                }
                ap0.resetXPath();
                while (ap1.evalXPath() != -1)
                {
                    long l      = vn.getElementFragment();
                    int  offset = (int)l;
                    int  len    = (int)(l >> 32);
                    fos.Write(ba3, 0, ba3.Length);
                    fos.Write(ba, offset, len);
                }
                ap1.resetXPath();
                while (ap2.evalXPath() != -1)
                {
                    long l      = vn.getElementFragment();
                    int  offset = (int)l;
                    int  len    = (int)(l >> 32);
                    fos.Write(ba3, 0, ba3.Length);
                    fos.Write(ba, offset, len);
                }
                ap2.resetXPath();
                fos.Write(ba3, 0, ba3.Length);
                fos.Write(ba2, 0, ba2.Length);
            }
        }
Example #22
0
 /// スプライト削除
 public void RemoveSprite(AutoPilot ap)
 {
     if (sprites.Count == 0)
     {
         return;                     // スプライトが無い場合はキャンセル
     }
     GameObject.Destroy(sprites[0]); // 一番古いスプライトを破棄
     sprites.RemoveAt(0);            // 破棄したスプライトをリストから削除
 }
Example #23
0
    public void RadarUnique(AutoPilot ap, Vector3 botPos, EnemyProp point)
    {
        Vector2 RelPos2D = (point.GetRadar2dLocation(botPos) * radarScale) + radarOffset;
        float   dir2d    = point.GetRadar2dAngle();

        Util.PolyMaker2D(ap, Color.yellow, 8 + radarScale * 5, 3, dir2d, RelPos2D);
        Util.PolyMaker2D(ap, Color.black, 6 + radarScale * 5, 3, dir2d, RelPos2D);
        // Util.PolyMaker2D(ap,Color.white,30,3,-90*Time.time/1.15f,RelPos2D/10);
    }
Example #24
0
        static void Main(string[] args)
        {
            try
            {
                //File f = new File("bioinfo.xml");
                // counting child elements of parlist
                int count = 0;
                // counting child elements of parlist named "par"
                int    par_count = 0;
                VTDGen vg        = new VTDGen();
                if (vg.parseFile("./bioinfo.xml", true))
                {
                    VTDNav    vn = vg.getNav();
                    AutoPilot ap = new AutoPilot();
                    ap.bind(vn);
                    ap.selectXPath("/bix/package/command/parlist");
                    while (ap.evalXPath() != -1)
                    {
                        count++;
                    }

                    ap.selectXPath("/bix/package/command/parlist/par");
                    while (ap.evalXPath() != -1)
                    {
                        par_count++;
                    }

                    // print out the results
                    Console.WriteLine(" count ====> " + count);
                    Console.WriteLine(" par_count ==> " + par_count);

                    // verify results using iterators
                    int v = 0;
                    vn.toElement(VTDNav.ROOT);
                    ap = new AutoPilot(vn);
                    ap.selectElement("par");
                    while (ap.iterate())
                    {
                        if (vn.getCurrentDepth() == 4)
                        {
                            v++;
                        }
                    }
                    Console.WriteLine(" verify ==> " + v);
                }
            }
            catch (NavException e)
            {
                Console.WriteLine(" Exception during navigation " + e);
            }
            catch (XPathParseException e)
            {
            }
            catch (XPathEvalException e)
            {
            }
        }
Example #25
0
        private void ChangeOffsetAction()
        {
            return;

            if (Mode == BehaviorMode.ApproachTarget)
            {
                AutoPilot.ReverseOffsetDirection(70);
            }
        }
Example #26
0
    public void PolyMaker2D(AutoPilot ap, Color color, float size, float sides, float angle, Vector2 pos)
    {
        float degree = 360 / sides;

        for (int i = 0; i < sides; i++)
        {
            ap.DrawLine2D(color, new Vector2(pos.x + size * Angle("sin", angle + degree * i), pos.y + size * Angle("cos", angle + degree * i)), new Vector2(pos.x + size * Angle("sin", angle + degree * i + degree), pos.y + size * Angle("cos", angle + degree * i + degree)));
            // ap.DrawLine2D(color, new Vector2(0,0), new Vector2(0,0));
        }
    }
Example #27
0
 public RadarLib(AutoPilot _ap, float dScrn, Vector2 offset, float scale, Vector2 radarWindow)
 {
     Scan             = new ScanLib(ap, dScrn);
     Util             = new UtilityLib(ap, dScrn);
     this.radarOffset = offset;
     this.radarScale  = scale;
     this.radarWindow = radarWindow;
     this.ap          = _ap;
     this.dScrn       = dScrn;
 }
Example #28
0
    public static void DrawLines(AutoPilot ap)
    {
        var pos1 = ap.GetPosition();

        for (int i = 0; i < 5000; ++i)
        {
            var pos2 = new Vector3(Random.Range(-100f, 100f), 10f, Random.Range(-100f, 100f));
            var col  = new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f));
            ap.DrawLine3D(col, pos1, pos2);
        }
    }
Example #29
0
        public void ReturnToDespawn()
        {
            if (Mode == BehaviorMode.ApproachTarget)
            {
                BehaviorTriggerC = true;
            }

            ChangeCoreBehaviorMode(BehaviorMode.ApproachWaypoint);
            AutoPilot.SetAutoPilotDataMode(AutoPilotDataMode.Primary);
            AutoPilot.ActivateAutoPilot(Settings.DespawnCoords, NewAutoPilotMode.RotateToWaypoint | NewAutoPilotMode.ThrustForward | NewAutoPilotMode.PlanetaryPathing | AutoPilot.UserCustomMode);
            _checkActiveTargetTimer = MyAPIGateway.Session.GameDateTime;
        }
Example #30
0
 public ScanLib(AutoPilot _ap, float dScrn)
 {
     Util                 = new UtilityLib(ap, dScrn);
     this.ap              = _ap;
     this.dScrn           = dScrn;
     this.enemybotProp    = new Dictionary <string, EnemyProp>();
     this.plasmaProp      = new Dictionary <string, EnemyProp>();
     this.bulletProp      = new List <GameObject>();
     this.lockedEnemyList = new List <EnemyProp>();
     this.topEnemyList    = new List <EnemyProp>();
     this.aim             = new List <Vector3>();
 }
        protected override bool Receive(object message)
        {
            global::System.Diagnostics.Debug.WriteLine("TestActor received " + message);
            var setIgnore = message as TestKit.TestActor.SetIgnore;
            if(setIgnore != null)
            {
                _ignore = setIgnore.Ignore;
                return true;
            }
            var watch = message as TestKit.TestActor.Watch;
            if(watch != null)
            {
                Context.Watch(watch.Actor);
                return true;
            }
            var unwatch = message as TestKit.TestActor.Unwatch;
            if(unwatch != null)
            {
                Context.Unwatch(unwatch.Actor);
                return true;
            }
            var setAutoPilot = message as TestKit.TestActor.SetAutoPilot;
            if(setAutoPilot != null)
            {
                _autoPilot = setAutoPilot.AutoPilot;
                return true;
            }

            var actorRef = Sender;
            if(_autoPilot != null)
            {
                var newAutoPilot = _autoPilot.Run(actorRef, message);
                if(!(newAutoPilot is KeepRunning))
                    _autoPilot = newAutoPilot;
            }
            if(_ignore == null || !_ignore(message))
                _queue.Enqueue(new RealMessageEnvelope(message, actorRef));
            return true;
        }
        private void btnDebug_Click(object sender, EventArgs e)
        {
            AutoPilot mA = new AutoPilot(30.0, 30.0,1000);

            StringBuilder sb = new StringBuilder();
            sb.Append("Target,Current,Diff,Roll\r\n");
            for (double j,i = -3.1; i <= 3.14; i += 0.3)
            {
                for (j = -3.1; j <= 3.14; j += 0.3)
                {
                    mA.CurrentHeading = i;
                    mA.TargetHeading = j;
                    mA.RollToBearingDifference();
                    sb.Append(mA.TargetHeading.ToString());
                    sb.Append(",");
                    sb.Append(mA.CurrentHeading.ToString());
                    sb.Append(",");
                    sb.Append(mA.HeadingDifference.ToString());
                    sb.Append(",");
                    sb.Append(mA.TargetRollAngle.ToString());
                    sb.Append("\r\n");
                }
            }
        }
        private void FgfsMainForm_Load(object sender, EventArgs e)
        {
            #region "Map Control init"
            // config map
            MainMap.MapProvider = GMapProviders.OpenStreetMap;
            MainMap.Position = new PointLatLng(const_StartLatitude, const_StartLongitude);
            MainMap.MinZoom = 1;
            MainMap.MaxZoom = 24;
            MainMap.Zoom = trkMapZoom.Value / 100;
            MainMap.CanDragMap = true;

            mAutoPilot= new AutoPilot(const_StartLatitude, const_StartLongitude, 2000);

            top = new GMapOverlay(MainMap,"top");
            mGMapRoutes = new GMapOverlay(MainMap, "routes");
            mGMapPolygons = new GMapOverlay(MainMap, "polygons");
            mGMapObjects = new GMapOverlay(MainMap, "objects");
            mGMapObjects.Markers.Add(mAutoPilot.GMapMarkerPlane);

            #region "GMap Custom Layer"
            {
                MainMap.Overlays.Add(mGMapRoutes);
                MainMap.Overlays.Add(mGMapPolygons);
                MainMap.Overlays.Add(mGMapObjects);
                MainMap.Overlays.Add(top);

                mGMapRoutes.Routes.CollectionChanged += new GMap.NET.ObjectModel.NotifyCollectionChangedEventHandler(Routes_CollectionChanged);
                mGMapObjects.Markers.CollectionChanged += new GMap.NET.ObjectModel.NotifyCollectionChangedEventHandler(Markers_CollectionChanged);
            }
            #endregion

            #region "MapEvents"

            MainMap.OnTileLoadStart += new TileLoadStart(MainMap_OnTileLoadStart);
            MainMap.OnTileLoadComplete += new TileLoadComplete(MainMap_OnTileLoadComplete);

            MainMap.OnMapTypeChanged += new MapTypeChanged(MainMap_OnMapTypeChanged);
            MainMap.OnPositionChanged += new PositionChanged(MainMap_OnPositionChanged);
            MainMap.OnMapZoomChanged += new MapZoomChanged(MainMap_OnMapZoomChanged);

            MainMap.OnMarkerClick += new MarkerClick(MainMap_OnMarkerClick);
            MainMap.OnMarkerEnter += new MarkerEnter(MainMap_OnMarkerEnter);
            MainMap.OnMarkerLeave += new MarkerLeave(MainMap_OnMarkerLeave);

            MainMap.MouseMove += new MouseEventHandler(MainMap_MouseMove);
            MainMap.MouseDown += new MouseEventHandler(MainMap_MouseDown);
            MainMap.MouseUp += new MouseEventHandler(MainMap_MouseUp);
            MainMap.MouseDoubleClick += new MouseEventHandler(MainMap_MouseDoubleClick);

            #endregion

            #endregion
        }
Example #34
0
 private void InitializeAutoPilot() {
     AutoPilot = new AutoPilot(this);
     AutoPilot.onDestinationReached += OnDestinationReached;
 }