예제 #1
0
    public static bool UP(Vector2 pos, ref JumpData jdata, ref MobMoveData data)
    {
        var hit = Physics2D.RaycastAll(pos, new Vector2(data.Dir, jdata.height), data.JumpAbleDist, data.JumpAbleLayer);

        //Debug.DrawRay(pos, new Vector2(data.Dir, jdata.height + data.JumpAbleDist), Color.red);
        return(hit.Length > 0);
    }
예제 #2
0
 public JumpEventArgs(int characterId, JumpData jumpData, short numLogins, short totalJumps)
 {
     this.CharacterId = characterId;
     this.Data = jumpData;
     this.NumLogins = numLogins;
     this.TotalJumps = totalJumps;
 }
예제 #3
0
    public static Collider2D GetVirJumpDetectGroundOrNull(Vector2 pos, ref JumpData jdata, Vector2 size, ref MobMoveData data, LayerMask soildGorund)
    {
        var _pos  = pos + new Vector2(0, jdata.height);
        var _dist = jdata.time * data.Speed;
        var hit   = Physics2D.BoxCast(_pos, size, 0, Vector2.right * data.Dir, _dist, soildGorund);

        return(hit.collider);
    }
예제 #4
0
파일: Ble.cs 프로젝트: Gabrola/MipSim
        public Ble(string instr, int instructionNumber, int rs, int rt, int imm)
            : base(instr, instructionNumber)
        {
            JumpData = new JumpData { Type = JumpType.JumpDirect, IsJumpTaken = false };

            _rs = rs;
            _rt = rt;
            _imm = imm;
        }
예제 #5
0
 public void Jump(JumpData jumpData)
 {
     switch (jumpData.Type)
     {
         case JumpType.Jump:
             _counter = (int)(_counter & 0xF0000000) | (jumpData.Address << 2);
             break;
         case JumpType.JumpDirect:
             _counter = jumpData.Address;
             break;
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
 public SelfJumpCompleteEventArgs(
     JumpData jumpData,
     IEnumerable<Location> trajectory,
     Location landingLocation,
     double maxHeightInMeters,
     double distanceJumpedInMeters,
     TimeSpan airTime)
 {
     this.JumpData = jumpData;
     this.Trajectory = trajectory.ToList().AsReadOnly();
     this.LandingLocation = landingLocation;
     this.MaxHeightInMeters = maxHeightInMeters;
     this.DistanceJumpedInMeters = distanceJumpedInMeters;
     this.AirTime = airTime;
 }
        private void BtnSetScore_Click(object sender, EventArgs e)
        {
            //Handle jump scoring and close by setting dialog result
            IList <double> stylePoints = new List <double>();

            stylePoints.Add((double)JumpStyle1Value.Value);
            stylePoints.Add((double)JumpStyle2Value.Value);
            stylePoints.Add((double)JumpStyle3Value.Value);
            stylePoints.Add((double)JumpStyle4Value.Value);
            stylePoints.Add((double)JumpStyle5Value.Value);
            //Positive change in platform (+meters in platform height) affects negatively to the score (-points)
            //User can simply enter the difference in the platform in meters
            JumpData jumpData = new JumpData((double)JumpLengthValue.Value, (double)JumpWindValue.Value, -(double)JumpPlatformValue.Value, stylePoints);

            _jump.ScoreJump(jumpData, _parameters);
            DialogResult = DialogResult.OK;
        }
예제 #8
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        JumpData j = (JumpData)target;

        GUILayout.BeginHorizontal("box");
        GUILayout.Label("Gravity");
        var gravity = -(2 * j.jumpHeight) / Mathf.Pow(j.timeToJumpApex, 2);

        GUILayout.Label(gravity.ToString());
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal("box");
        GUILayout.Label("Jump Velocity");
        var jumpVelocity = Mathf.Abs(gravity) * j.timeToJumpApex;

        GUILayout.Label(jumpVelocity.ToString());
        GUILayout.EndHorizontal();
    }
예제 #9
0
 private CapsuleLevelVo FindLevel(JumpData jumpData)
 {
     foreach (var vo in _capsuleBattleLevelDict)
     {
         if (jumpData.Type == "H")
         {
             if (vo.Value.Hardness == GameTypePB.Difficult && vo.Value.LevelMark == jumpData.Data)
             {
                 return(vo.Value);
             }
         }
         else
         {
             if (vo.Value.Hardness == GameTypePB.Ordinary && vo.Value.LevelMark == jumpData.Data)
             {
                 return(vo.Value);
             }
         }
     }
     return(null);
 }
예제 #10
0
        public static void ImportData(string[] args)

        {
            populateNotificationData();
            using (StreamReader sr = new StreamReader(@"config\config.txt"))
            {
                for (int i = 0; i < 3; i++)
                {
                    string[] data = sr.ReadLine().Replace(" ", "").Split(',');
                    setData(data);
                }
            }

            jumpData = new JumpData();
            using (StreamReader sr = new StreamReader("db/data.csv"))
            {
                string[] data     = sr.ReadLine().Replace(" ", "").Split(',');
                bool     onTarget = false;
                if (data[0] == "target" && data[1].Replace("\"", "") == config.target)
                {
                    if (jumpData == null)
                    {
                        jumpData = new JumpData();
                    }
                    if (jumpData.jumpNumber == null)
                    {
                        jumpData.jumpNumber = new List <JumpNumber>();
                    }
                    while (!onTarget)
                    {
                        data = sr.ReadLine()?.Split(',');
                        if (data != null && data.Length > 0 && data[0] == "target" || data == null)
                        {
                            break;
                        }

                        var jn = new JumpNumber();
                        jn.system = data[0].Replace("\"", "").Trim();
                        if (data.Length > 1)
                        {
                            jn.jumps = data[1].Trim();
                            jumpData.jumpNumber.Add(jn);
                        }
                    }
                }
                foreach (var jn in jumpData.jumpNumber)
                {
                    Console.WriteLine($"{jn.system} : {jn.jumps}");
                }
            }

            using (StreamReader sr = new StreamReader("db/named.csv"))
            {
                named = sr.ReadLine().Split(',');
            }
            using (StreamReader sr = new StreamReader("db/special.csv"))
            {
                string[] data     = sr.ReadLine().Split(',');
                bool     onTarget = false;


                if (jumpData.special == null)
                {
                    jumpData.special = new List <JumpNumber>();
                }
                while (!onTarget)
                {
                    data = sr.ReadLine()?.Split(',');
                    if (data != null && data.Length > 0 && data[0] == "target" || data == null)
                    {
                        break;
                    }

                    var jn = new JumpNumber();
                    jn.system = data[0].Replace("\"", "");
                    if (data.Length > 1)
                    {
                        jn.jumps = data[1];
                        jumpData.special.Add(jn);
                    }
                }

                foreach (var jn in jumpData.special)
                {
                    Console.WriteLine($"special: {jn.system} : {jn.jumps}");
                }
            }
            Console.WriteLine($"target: {config.target}  {DateTime.Now}");
        }
예제 #11
0
 public ReturnProcedure(string instr, int instructionNumber)
     : base(instr, instructionNumber)
 {
     JumpData = new JumpData { Type = JumpType.JumpDirect, IsJumpTaken = false };
 }
예제 #12
0
파일: JR.cs 프로젝트: Gabrola/MipSim
 public JR(string instr, int instructionNumber, int rs)
     : base(instr, instructionNumber)
 {
     _rs = rs;
     JumpData = new JumpData { Type = JumpType.JumpDirect, IsJumpTaken = false };
 }
예제 #13
0
 /// <summary>
 /// 跳转到其他模块
 /// </summary>
 /// <param name="data"></param>
 /// <param name="removePrev"></param>
 /// <param name="hidePrev"></param>
 /// <returns></returns>
 public void EnterModule(JumpData data, bool removePrev = false, bool hidePrev = true)
 {
     EnterModule(data.Module, removePrev, hidePrev, data);
 }
예제 #14
0
파일: Jal.cs 프로젝트: Gabrola/MipSim
 public Jal(string instr, int instructionNumber, int address)
     : base(instr, instructionNumber)
 {
     JumpData = new JumpData { Type = JumpType.Jump, IsJumpTaken = false, Address = address };
 }
예제 #15
0
        static void Main(string[] args)
        {
            Console.WindowHeight = Console.LargestWindowHeight >= 40 ? 40 : Console.LargestWindowHeight;
            Console.Title        = "Ski jumping points calculator tester";
            Console.WriteLine("Ski jumping points calculator tester!");

            //Load event information, parameters and competitors from a file
            Event competitionEvent = EventLoader.LoadXML("../../../../Testevent.xml");

            Console.WriteLine("\nEvent:{0}", competitionEvent.ToString());
            Console.WriteLine("\nEvent parameters:\n{0}", competitionEvent.Parameters.ToString());
            Console.WriteLine("\nEvent competitors:");
            foreach (EventCompetitor c in competitionEvent.Competitors)
            {
                Console.WriteLine("\nCompetitor:{0}", c.ToString());
            }

            //Test data
            Random          rng                = new Random();
            EventCompetitor testCompetitor     = new EventCompetitor("0000", "Test", "Jumper", "FIN");
            double          length             = 124;
            double          windCorrection     = 1.4;
            double          platformCorrection = -1.4;
            IList <double>  stylePoints        = new List <double>()
            {
                18, 18.5, 18.5, 19, 19
            };
            JumpData singleJumpData = new JumpData(length, windCorrection, platformCorrection, stylePoints);

            //Make and score a single test jump
            Jump singleJump = new Jump(testCompetitor);

            singleJump.ScoreJump(singleJumpData, competitionEvent.Parameters);
            Console.WriteLine("\nSingle jump test:\n{0}", singleJump.ToString());

            //Event starts
            //Event has 1..n EventRound(s) and has 1 EventResult(s)
            //EventRound has 1..n Jumps that have 1 Competitor, 1 Jump data and 1 Jump score
            //Event.Parameters are used together with Jump data to calculate Jump score

            //This is not necessarily the best approach, depending on the application type
            //Alternative handle rounds in application and set round data to the Event, after the round has been completed
            //Alternatively, update round jump data at the Event after each jump
            //First round
            EventRound firstRound = competitionEvent.GetFirstRound();

            //Now done by Event in previous step

            /*
             * //Add competitors to the round
             * //Competitors are simply ordered according to their order in the Event
             * //Could be potentially hidden from application by Event and EventRound methods
             * foreach (EventCompetitor c in competitionEvent.Competitors)
             * {
             *  firstRound.AddJump(new Jump(c));
             * }
             */

            //Make first round test jumps, set data about jump and calculate and set score
            //Could be potentially partially hidden from application by an Event method
            //Consider during application design
            foreach (Jump jump in firstRound.Jumps)
            {
                JumpData jumpData = new JumpData(rng.Next(100, 130 + 1), windCorrection, platformCorrection, stylePoints);
                jump.ScoreJump(jumpData, competitionEvent.Parameters);
                //Previous implementation, not compatible with library changes
                //competitionEvent.AddResult(jump.Competitor, jump.Score);
                //New implementation, update result, following library changes
                competitionEvent.UpdateResult(jump.Competitor, jump.Score);
                //Console.WriteLine("\nFirst round jump:\nCompetitor:{0}\nJump:{1}\nScore: {2:F2}", jump.Competitor.ToString(), jump.Data.ToString(), jump.Score);
            }

            /*
             * //Display first round results
             * //Could be potentially partially hidden from application by an Event method
             * foreach (EventResult r in competitionEvent.Results)
             * {
             *  Console.WriteLine("\nFirst round results:\nCompetitor:{0}\nScore: {1:F2}", r.Competitor.ToString(), r.Score);
             * }
             */

            //Second round
            //Second round is currently not fully supported after library changes, see below
            //EventRound secondRound = competitionEvent.GetNextRound();

            //Now done by Event in previous step

            /*
             * //Add competitors to the round, based on their first round score, in reverse order
             * foreach (EventResult r in competitionEvent.Results.Reverse().ToList())
             * {
             *  secondRound.AddJump(new Jump(r.Competitor));
             * }
             */

            //Previous implementation, not compatible with library changes
            //Current update method just updates the existing score with the new one, instead of incrementing the score
            //If suppport for multiple rounds is later required, increment functionality can be added to the library

            /*
             * //Make second round test jumps, set data about jump and calculate and set score
             * foreach (Jump j in secondRound.Jumps)
             * {
             *  JumpData jumpData = new JumpData(rng.Next(100, 130 + 1), windCorrection, platformCorrection, stylePoints);
             *  j.ScoreJump(jumpData, competitionEvent.Parameters);
             *  competitionEvent.UpdateResult(j.Competitor, j.Score);
             *  //Console.WriteLine("\nSecond round jump:\nCompetitor:{0}\nJump:{1}\nScore: {2:F2}", j.Competitor.ToString(), j.Data.ToString(), j.Score);
             * }
             */

            //Display jumps by round
            foreach (EventRound r in competitionEvent.Rounds)
            {
                Console.WriteLine("\n{0} jumps:", r.RoundName);
                foreach (Jump j in r.Jumps)
                {
                    //Console.WriteLine("\nCompetitor:{0}\nJump:{1}\nScore: {2}", j.Competitor.ToString(), j.Data.ToString(), j.Score);
                    Console.WriteLine("{0}", j.ToString());
                }
            }

            //Display event final results
            Console.WriteLine("\nFinal results:");
            foreach (EventResult r in competitionEvent.Results)
            {
                Console.WriteLine("\n{0}\nScore: {1:F2}", r.Competitor.ToString(), r.Score);
            }

            Console.ReadLine();
        }
예제 #16
0
 public JumpProcedure(string instr, int instructionNumber, int address)
     : base(instr, instructionNumber)
 {
     JumpData = new JumpData { Type = JumpType.Jump, Address = address, IsJumpTaken = false };
 }