Beispiel #1
0
        protected override void BuildMessage(IEventArgs args)
        {
            this.scope = "4";

            builder.Key = FreeMessageConstant.AirLineData;
            builder.Bs.Add(true);

            Vector2 start = ChickenRuleVars.GetAirLineStartPos(args);
            Vector2 stop  = ChickenRuleVars.GetAirLineStopPos(args);

            builder.Fs.Add(start.x);
            builder.Fs.Add(start.y);
            builder.Fs.Add(stop.x);
            builder.Fs.Add(stop.y);
        }
        public bool Meet(IEventArgs args)
        {
            FreeEntityData entity = ChickenRuleVars.GetDropPlane(args);

            if (entity != null)
            {
                int x = ChickenRuleVars.GetFogStopX(args);
                int y = ChickenRuleVars.GetFogStopY(args);
                int r = ChickenRuleVars.GetFogStopRadius(args);

                float flyX = entity.FreeMoveEntity.position.Value.x;
                float flyY = entity.FreeMoveEntity.position.Value.z;
                if ((x - flyX) * (x - flyX) + (y - flyY) * (y - flyY) <= r * r)
                {
                    return(true);
                }
            }

            return(false);
        }
        protected override void BuildMessage(IEventArgs args)
        {
            this.scope = "4";

            builder.Key = FreeMessageConstant.AirLineData;
            builder.Bs.Add(false);

            Vector2 start = ChickenRuleVars.GetAirLineStartPos(args);
            Vector2 stop  = ChickenRuleVars.GetAirLineStopPos(args);

            int totalTime = args.GetInt("{waitFlyTime}");
            int startTime = args.GetInt("{canJumpTime}") / 1000;
            int forceTime = args.GetInt("{forceJumpTime}") / 1000;

            Vector2 from = start + (stop - start) * startTime / totalTime;
            Vector2 to   = start + (stop - start) * forceTime / totalTime;

            Debug.LogFormat("{0} to {1}, {2} {3} {4}", from, to, totalTime, startTime, forceTime);

            builder.Fs.Add(from.x);
            builder.Fs.Add(from.y);
            builder.Fs.Add(to.x);
            builder.Fs.Add(to.y);
        }