예제 #1
0
        public TimeSpan GetCurrentVideoPosition()
        {
            DataReqEventArgs eData = new DataReqEventArgs();

            GetPosition?.Invoke(this, eData);
            return(eData.Position);
        }
예제 #2
0
        private bool GetMouseTargetRow(Visual theTarget, GetPosition position)
        {
            var   rect  = VisualTreeHelper.GetDescendantBounds(theTarget);
            Point point = position((IInputElement)theTarget);

            return(rect.Contains(point));
        }
예제 #3
0
        private Vector3 GetObjectForceAroundMe <T>(double maxDistance = 16) where T : WowObject
        {
            Vector3 force           = new Vector3(0, 0, 0);
            Vector3 vehiclePosition = GetPosition.Invoke();
            int     count           = 0;

            List <(Vector3, double)> objectDistances = new List <(Vector3, double)>();

            // we need to know every objects position and distance
            // to later apply a force pushing us back from it that
            // is relational to the objects distance.
            foreach (WowObject obj in ObjectManager.WowObjects.OfType <T>())
            {
                double distance = obj.Position.GetDistance(vehiclePosition);

                if (distance < maxDistance)
                {
                    objectDistances.Add((obj.Position, distance));
                }
            }

            // get the biggest distance to normalize the fleeing forces
            float normalizingMultiplier = Convert.ToSingle(objectDistances.Max(e => e.Item2));

            foreach ((Vector3, double)obj in objectDistances)
            {
                force += Flee(obj.Item1, Convert.ToSingle(obj.Item2) * normalizingMultiplier);
                count++;
            }

            // return the average force
            return(force / count);
        }
예제 #4
0
        //string PositionString;
        public void OnButtonPlayClick_Click(object sender, EventArgs e)
        {
            if (outputDevice == null)
            {
                outputDevice = new WaveOutEvent();                      //WaveOutEvent best option for sending audio to soundcard
                outputDevice.PlaybackStopped += OnPlaybackStopped;      // to add ASIO - github.com/naudio/NAudio/blob/master/Docs/AsioPlayback.md
            }
            if (audioFile == null)
            {
                audioFile = new AudioFileReader(textBox1.Text);                             //audioFile = new AudioFileReader(@"c:\aphextwin.mp3");     //hardcoded directory
                outputDevice.Init(audioFile);
            }
            else
            {
            }

            outputDevice.Play();
            long GetPosition;

            GetPosition    = outputDevice.GetPosition();
            PositionString = GetPosition.ToString();             //converts bytes to string
            textBox2.Text  = PositionString;

            Task.Factory.StartNew(() => { printPositionString(); });
        }
예제 #5
0
        private DragAndDrop(DiagramItem attachedElement, GetPosition get, SetPosition set)
        {
            _item = attachedElement;
            _get  = get;
            _set  = set;

            hookEvents();
        }
예제 #6
0
        public void PositionWorks()
        {
            var parser = GetPosition
                         .ThenIgnore(Match('a'))
                         .Then(GetPosition, (l, r) => $"{l} - {r}")
                         .CompileParser("PositionWorks");

            parser.AssertSuccess("a", "0 - 1", 1);
        }
예제 #7
0
    // Use this for initialization

    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        positionXLeft  = maxLeft.transform.position.x;
        positionXRight = maxRight.transform.position.x;
    }
예제 #8
0
        private static bool IsMouseTargetItem(Visual theTarget, GetPosition pos)
        {
            if (null == theTarget)
            {
                return(false);
            }
            Rect  rect  = VisualTreeHelper.GetDescendantBounds(theTarget);
            Point point = pos((IInputElement)theTarget);

            return(rect.Contains(point));
        }
예제 #9
0
        private bool GetMouseTargetMark(Visual theTarget, GetPosition position)
        {
            if (theTarget == null)
            {
                return(false);
            }
            Rect  rect  = VisualTreeHelper.GetDescendantBounds(theTarget);
            Point point = position((IInputElement)theTarget);

            return(rect.Contains(point));
        }
예제 #10
0
파일: Room.cs 프로젝트: sxtgyrq/VRPGame
 /// <summary>
 /// 发送此命令,必在await setState(s, webSocket, LoginState.OnLine) 之后。两者是在前台是依托关系!
 /// </summary>
 /// <param name="s"></param>
 /// <returns></returns>
 private async static Task initializeOperation(State s)
 {
     // var key = CommonClass.Random.GetMD5HashFromStr(ConnectInfo.ConnectedInfo + websocketID + DateTime.Now.ToString());
     // var roomUrl = roomUrls[s.roomIndex];
     var getPosition = new GetPosition()
     {
         c   = "GetPosition",
         Key = s.Key
     };
     var msg    = Newtonsoft.Json.JsonConvert.SerializeObject(getPosition);
     var result = await Startup.sendInmationToUrlAndGetRes(Room.roomUrls[s.roomIndex], msg);
 }
예제 #11
0
        public void ThenCreateStringWorks()
        {
            var parser = GetPosition
                         .ThenIgnore(Text('a').Required())
                         .ThenIgnore(Text('b').Required())
                         .ThenCreateSpan()
                         .CompileParser("ThenCreateStringWorks");

            parser.AssertSuccess("aabbcc", new StringSpan("aabbcc", 0, 4), 4);
            parser.AssertSuccess("abab", new StringSpan("abab", 0, 2), 2);
            parser.AssertFailure("c", 0);
        }
예제 #12
0
        private int GetCurrentMark(GetPosition pos)
        {
            int curIndex = -1;

            for (int i = 0; i < MainTabView.Items.Count; i++)
            {
                if (GetMouseTargetMark(MainTabView.Items[i] as TabItem, pos))
                {
                    curIndex = MainTabView.Items.IndexOf(MainTabView.Items[i] as TabItem);
                    break;
                }
            }
            return(curIndex);
        }
예제 #13
0
        private int GetCurrentMark(GetPosition pos)
        {
            int curIndex = -1;

            for (int i = 0; i < MarksEllipseList.Count; i++)
            {
                if (GetMouseTargetMark(MarksEllipseList[i], pos))
                {
                    curIndex = Convert.ToInt32(MarksEllipseList[i].Name.Split('_').Last());
                    break;
                }
            }
            return(curIndex);
        }
예제 #14
0
        private int GetCurrentRowIndex(GetPosition pos, System.Windows.Controls.DataGrid MarksDataGrid)
        {
            int curIndex = -1;

            for (int i = 0; i < MarksDataGrid.Items.Count; i++)
            {
                System.Windows.Controls.DataGridRow itm = GetRowItem(i, MarksDataGrid);
                if (GetMouseTargetRow(itm, pos))
                {
                    curIndex = i;
                    break;
                }
            }
            return(curIndex);
        }
예제 #15
0
        private int GetCurrentRowIndex(GetPosition pos)
        {
            int curIndex = -1;

            for (int i = 0; i < ActiveGrid.Items.Count; i++)
            {
                DataGridRow itm = GetRowItem(i);
                if (GetMouseTargetRow(itm, pos))
                {
                    curIndex = i;
                    break;
                }
            }
            return(curIndex);
        }
예제 #16
0
        /// <summary>
        /// Sends GetPosition message.
        /// </summary>
        public long GetPosition()
        {
            byte[] serialized;

            var message = new GetPosition {
            };
            {
                serialized = message.Serialize(); Writer.Write(serialized.Length); Writer.Write(serialized);
            }

            long result = Reader.ReadInt64();
            {
                return(result);
            }
        }
        int GetCurrentRowIndex(GetPosition pos)
        {
            int curIndex = -1;

            for (int i = 0; i < dataGrid.Items.Count; i++)
            {
                DataGridRow itm = this.dataGrid.GetRow(i);
                if (GetMouseTargetRow(itm, pos))
                {
                    curIndex = i;
                    break;
                }
            }
            Console.WriteLine("GetCurrentRowIndex : " + curIndex);
            return(curIndex);
        }
예제 #18
0
 /// <summary>
 /// GetMouseTargetItem
 /// </summary>
 /// <param name="selector">thisSelector</param>
 /// <param name="pos">GetPosition</param>
 /// <returns>DependencyObject</returns>
 public static DependencyObject GetMouseTargetItem(this Selector selector, GetPosition pos)
 {
     if (null == selector)
     {
         return(null);
     }
     for (int i = 0; i < selector.Items.Count; i++)
     {
         var itm = selector.GetItemByIndex(i);
         if (IsMouseTargetItem(itm as Visual, pos))
         {
             return(itm);
         }
     }
     return(null);
 }
예제 #19
0
        private int GetCurrentRowIndex(GetPosition pos)
        {
            int curIndex = -1;

            for (int i = 0; i < InstalledAssembliesDataGrid.Items.Count; i++)
            {
                DataGridRow  row  = GetRowItem(i);
                DataGridCell cell = GetCell(row);
                if (row != null && cell != null &&
                    GetMouseTargetRow(row, pos) && !GetMouseTargetRow(cell, pos))
                {
                    curIndex = i;
                    break;
                }
            }
            return(curIndex);
        }
예제 #20
0
        private bool GetMouseTargetRow(Visual theTarget, GetPosition position)
        {
            Rect rect;

            try
            {
                rect = VisualTreeHelper.GetDescendantBounds(theTarget);
            }
            catch
            {
                log.Trace("拖拽得太狠啦 - 2");
                return(false);
            }
            Point point = position((IInputElement)theTarget);

            return(rect.Contains(point));
        }
예제 #21
0
        private int GetCurrentRowIndex(GetPosition pos)
        {
            var curIndex = -1;

            for (var i = 0; i < this.InstalledAssembliesDataGrid.Items.Count; i++)
            {
                var row = this.GetRowItem(i);
                if (row != null)
                {
                    var cell = this.GetCell(row);
                    if (cell != null && this.GetMouseTargetRow(row, pos) && !this.GetMouseTargetRow(cell, pos))
                    {
                        curIndex = i;
                        break;
                    }
                }
            }
            return(curIndex);
        }
        static IParser <List <StringSpan> > _ParseCsvLine()
        {
            var quote      = Match('"');
            var comma      = Match(',');
            var whitespace = Text(' ', '\t');
            var eol        = Text('\r', '\n').Required();

            var doubleQuote   = quote.ThenIgnore(quote);
            var quotedContent = GetPosition
                                .ThenIgnore(Any(quote.Not(), doubleQuote).Many(keepResults: false))
                                .ThenCreateSpan();

            var quotedValue   = quote.ThenKeep(quotedContent).ThenIgnore(quote);
            var unquotedValue = Text(x => x != '"' && x != ',' && x != '\n' && x != '\r');
            var value         = Any(quotedValue, unquotedValue).ThenIgnore(whitespace);
            var line          = value.Many(comma.ThenIgnore(whitespace)).ThenIgnore(eol);

            return(line.CompileParser("CsvLineParserSpan"));
        }
예제 #23
0
        private int GetCurrentRowIndex(GetPosition pos)
        {
            int curIndex = -1;

            for (int i = 0; i < dataGrid.Items.Count; i++)
            {
                DataGridRow itm = GetRowItem(i);
                if (itm != null)
                {
                    if (GetMouseTargetRow(itm, pos))
                    {
                        curIndex = i;
                        break;
                    }
                }
                else
                {
                    log.Trace("拖拽得太狠啦或拽到了AV号 - 1");
                }
            }
            return(curIndex);
        }
예제 #24
0
 private bool GetMouseTargetRow(Visual theTarget, GetPosition position)
 {
     Rect rect = VisualTreeHelper.GetDescendantBounds(theTarget);
     Point point = position((IInputElement)theTarget);
     return rect.Contains(point);
 }
예제 #25
0
 private int GetCurrentRowIndex(GetPosition pos)
 {
     int curIndex = -1;
     for (int i = 0; i < InstalledAssembliesDataGrid.Items.Count; i++)
     {
         DataGridRow itm = GetRowItem(i);
         if (GetMouseTargetRow(itm, pos))
         {
             curIndex = i;
             break;
         }
     }
     return curIndex;
 }
예제 #26
0
        public void Execute()
        {
            if (CurrentPath.Count == 0 || CurrentPathTargetPosition.GetDistance(TargetPosition) > 1)
            {
                List <Vector3> nodes = GeneratePath.Invoke(GetPosition.Invoke(), TargetPosition);

                if (nodes.Count == 0)
                {
                    // pathfinding was unsuccessful
                    return;
                }

                foreach (Vector3 node in nodes)
                {
                    CurrentPath.Enqueue(node);
                }

                CurrentPathTargetPosition = TargetPosition;
            }

            List <Vector3> forces                   = new List <Vector3>();
            Vector3        currentPosition          = GetPosition.Invoke();
            Vector3        targetPosition           = CurrentPath.Peek();
            double         distanceToTargetPosition = currentPosition.GetDistance2D(targetPosition);

            if (distanceToTargetPosition < MovementSettings.WaypointCheckThreshold)
            {
                if (CurrentPath.Count > 0)
                {
                    targetPosition = CurrentPath.Dequeue();
                }
                else if (CurrentPath.Count == 0)
                {
                    return;
                }
            }

            Vector3 positionToGoTo = MoveAhead(targetPosition, 1.5);

            switch (State)
            {
            case MovementEngineState.Moving:
                forces.Add(PlayerVehicle.Seek(positionToGoTo, 1));
                break;

            case MovementEngineState.Following:
                forces.Add(PlayerVehicle.Seek(positionToGoTo, 1));
                forces.Add(PlayerVehicle.Seperate(1));
                break;

            case MovementEngineState.Chasing:
                forces.Add(PlayerVehicle.Pursuit(positionToGoTo, 1, TargetRotation));
                break;

            case MovementEngineState.Fleeing:
                forces.Add(PlayerVehicle.Flee(positionToGoTo, 1));
                break;

            case MovementEngineState.Evading:
                forces.Add(PlayerVehicle.Evade(positionToGoTo, 1, TargetRotation));
                break;

            case MovementEngineState.Wandering:
                forces.Add(PlayerVehicle.Wander(1));
                break;

            case MovementEngineState.Stuck:
                forces.Add(PlayerVehicle.Unstuck(1));
                break;

            default:
                return;
            }

            // move
            PlayerVehicle.Update(forces);

            if (DateTime.Now - LastJumpCheck > TimeSpan.FromMilliseconds(500))
            {
                double distanceTraveled = LastPosition.GetDistance(GetPosition.Invoke());
                if ((LastPosition.X == 0 && LastPosition.Y == 0 && LastPosition.Z == 0) || distanceTraveled < 0.5)
                {
                    Jump.Invoke();
                }

                LastPosition  = GetPosition.Invoke();
                LastJumpCheck = DateTime.Now;
            }

            HasMoved = true;
        }
예제 #27
0
파일: Spawner.cs 프로젝트: Mothil93/Akiro
    void Start()
    {
        getPos = GetComponent<GetPosition>();

        enemyPoolList = new List<GameObject>();
        shrimpPoolList = new List<GameObject>();

        enemyContainer = new GameObject
            ("Spawned Enemies: " + pooledEnemies);
        shrimpContainer = new GameObject
            ("Spawned Shrimps: " + pooledShrimps);

        for (int i = 0; i < pooledEnemies; i++)
        {
            int randomEnemy = Random.Range
                (0, enemies.Length);

            GameObject enemy =
                (GameObject) Instantiate(enemies[randomEnemy]);
            enemy.name = enemies[randomEnemy].name;
            enemy.transform.parent = enemyContainer.transform;

            enemy.SetActive(false);
            enemyPoolList.Add(enemy);

        }

        for (int s = 0; s < pooledShrimps; s++)
        {
            int randomShrimp = Random.Range
                (0, shrimps.Length);

            GameObject shrimp =
                (GameObject)Instantiate(shrimps[randomShrimp]);
            shrimp.name = shrimps[randomShrimp].name;
            shrimp.transform.parent = shrimpContainer.transform;

            shrimp.SetActive(false);
            shrimpPoolList.Add(shrimp);
        }
    }
예제 #28
0
파일: _Spawner.cs 프로젝트: Mothil93/Akiro
    void Start()
    {
        Entity pufferfish = new Entity();
        pufferfish.delay = 1f;
        pufferfish.rate = .9f;
        pufferfish.obj = Pufferfish;
        pufferfish.amount = 10;
        pufferfish.list = new List<GameObject>();

        Entity jellyfish = new Entity();
        jellyfish.delay = .1f;
        jellyfish.rate = .3f;
        jellyfish.obj = Jellyfish;
        jellyfish.amount = 10;
        jellyfish.list = new List<GameObject>();

        Entity bigboy = new Entity();
        bigboy.delay = .1f;
        bigboy.rate = .3f;
        bigboy.obj = Bigboy;
        bigboy.amount = 20;
        bigboy.list = new List<GameObject>();

        getPos = GetComponent<GetPosition>();

        poolList = new List<GameObject>();

        enemyContainer = new GameObject
            ("Spawned Objects");

        StoreAmountOfObjects(bigboy);
        StoreAmountOfObjects(pufferfish);
        StoreAmountOfObjects(jellyfish);

        SpawnObj(pufferfish.delay, pufferfish.rate);
    }
예제 #29
0
 internal static void Attach(DiagramItem attachedElement, GetPosition get, SetPosition set)
 {
     new DragAndDrop(attachedElement, get, set);
 }
예제 #30
0
        public void Execute()
        {
            if ((DateTime.Now - LastLastPositionUpdate > TimeSpan.FromMilliseconds(1000) && LastPosition.GetDistance(GetPosition.Invoke()) > 24) || TryCount > 2)
            {
                Reset();
                return;
            }

            if (CurrentPath.Count == 0)
            {
                TryCount = 0;
                List <Vector3> nodes = GeneratePath.Invoke(GetPosition.Invoke(), TargetPosition);

                if (nodes.Count == 0)
                {
                    // pathfinding was unsuccessful
                    return;
                }

                foreach (Vector3 node in nodes)
                {
                    CurrentPath.Enqueue(node);
                }

                CurrentPathTargetPosition = TargetPosition;
            }

            List <Vector3> forces                   = new List <Vector3>();
            Vector3        currentPosition          = GetPosition.Invoke();
            Vector3        targetPosition           = CurrentPath.Peek();
            double         distanceToTargetPosition = currentPosition.GetDistance(targetPosition);

            if (distanceToTargetPosition > 128)
            {
                Reset();
                return;
            }
            else if (distanceToTargetPosition < MovementSettings.WaypointCheckThreshold)
            {
                if (CurrentPath.Count > 0)
                {
                    targetPosition = CurrentPath.Dequeue();
                }
                else if (CurrentPath.Count == 0)
                {
                    return;
                }
            }

            Vector3 positionToGoTo = BotUtils.MoveAhead(GetRotation.Invoke(), targetPosition, 2);
            bool    updateForces   = true;

            switch (State)
            {
            case MovementEngineState.Moving:
                forces.Add(PlayerVehicle.Seek(positionToGoTo, 1));
                break;

            case MovementEngineState.DirectMoving:
                PlayerVehicle.MoveToPosition(targetPosition);
                updateForces = false;
                break;

            case MovementEngineState.Following:
                forces.Add(PlayerVehicle.Seek(positionToGoTo, 1));
                forces.Add(PlayerVehicle.Seperate(1));
                break;

            case MovementEngineState.Chasing:
                forces.Add(PlayerVehicle.Seek(positionToGoTo, 1));
                break;

            case MovementEngineState.Fleeing:
                forces.Add(PlayerVehicle.Flee(positionToGoTo, 1));
                break;

            case MovementEngineState.Evading:
                forces.Add(PlayerVehicle.Evade(positionToGoTo, 1, TargetRotation));
                break;

            case MovementEngineState.Wandering:
                forces.Add(PlayerVehicle.Wander(1));
                break;

            case MovementEngineState.Stuck:
                forces.Add(PlayerVehicle.Unstuck(1));
                break;

            default:
                return;
            }

            if (updateForces)
            {
                PlayerVehicle.Update(forces);
            }

            if (DateTime.Now - LastJumpCheck > TimeSpan.FromMilliseconds(250))
            {
                double distanceTraveled = LastPosition.GetDistance(GetPosition.Invoke());
                if ((LastPosition.X == 0 && LastPosition.Y == 0 && LastPosition.Z == 0) || distanceTraveled < 0.3)
                {
                    Jump.Invoke();
                    TryCount++;
                }

                LastPosition           = GetPosition.Invoke();
                LastLastPositionUpdate = DateTime.Now;
                LastJumpCheck          = DateTime.Now;
            }

            LastTargetPosition = GetPosition.Invoke();
            HasMoved           = true;
        }
예제 #31
0
 /// <summary>
 /// Sends GetPosition message.
 /// </summary>
 private void GetPosition(GetPosition message)
 {
     Writer.Write(FileStream.Position);
 }
예제 #32
0
        public GetPositionResult GetPosition(GetPosition getPosition)
        {
            GetPositionResult result;

            int OpenMore   = -1;//第一次打开?
            var notifyMsgs = new List <string>();

            lock (this.PlayerLock)
            {
                if (this._Players.ContainsKey(getPosition.Key))
                {
                    if (this._Players[getPosition.Key].playerType == RoleInGame.PlayerType.player)
                    {
                        var player      = (Player)this._Players[getPosition.Key];
                        var fp          = Program.dt.GetFpByIndex(this._Players[getPosition.Key].StartFPIndex);
                        var fromUrl     = player.FromUrl;
                        var webSocketID = player.WebSocketID;
                        //var carsNames = this._Players[getPosition.Key].CarsNames;
                        var playerName = this._Players[getPosition.Key].PlayerName;

                        /*
                         * 这已经走查过,在AddNewPlayer、UpdatePlayer时,others都进行了初始化
                         */
                        AddOtherPlayer(getPosition.Key, ref notifyMsgs);
                        //   this.brokenParameterT1RecordChanged(getPosition.Key, getPosition.Key, this._Players[getPosition.Key].brokenParameterT1, ref notifyMsgs);
                        GetAllCarInfomationsWhenInitialize(getPosition.Key, ref notifyMsgs);
                        //getAllCarInfomations(getPosition.Key, ref notifyMsgs);
                        OpenMore = ((Player)this._Players[getPosition.Key]).OpenMore;

                        // var player = this._Players[getPosition.Key];
                        //var m2 = player.GetMoneyCanSave();

                        //    MoneyCanSaveChanged(player, m2, ref notifyMsgs);

                        SendPromoteCountOfPlayer("mile", player, ref notifyMsgs);
                        SendPromoteCountOfPlayer("business", player, ref notifyMsgs);
                        SendPromoteCountOfPlayer("volume", player, ref notifyMsgs);
                        SendPromoteCountOfPlayer("speed", player, ref notifyMsgs);

                        //   BroadCoastFrequency(player, ref notifyMsgs);
                        player.SetMoneyCanSave(player, ref notifyMsgs);

                        // player.RunSupportChangedF(ref notifyMsgs);
                        //player.this._Players[addItem.Key].SetMoneyCanSave = RoomMain.SetMoneyCanSave;
                        //MoneyCanSaveChanged(player, player.MoneyForSave, ref notifyMsgs);

                        SendMaxHolderInfoMation(player, ref notifyMsgs);

                        var players = this._Players;
                        foreach (var item in players)
                        {
                            if (item.Value.TheLargestHolderKey == player.Key)
                            {
                                player.TheLargestHolderKeyChanged(item.Key, item.Value.TheLargestHolderKey, item.Key, ref notifyMsgs);
                            }
                        }
                        var list = player.usedRoadsList;
                        for (var i = 0; i < list.Count; i++)
                        {
                            this.DrawSingleRoadF(player, list[i], ref notifyMsgs);
                        }

                        //this._Players[getPosition.Key];
                        ((Player)this._Players[getPosition.Key]).MoneyChanged(player, this._Players[getPosition.Key].Money, ref notifyMsgs);
                        ((Player)this._Players[getPosition.Key]).ShowLevelOfPlayerDetail(ref notifyMsgs);
                        this.DriverSelected(this._Players[getPosition.Key], this._Players[getPosition.Key].getCar(), ref notifyMsgs);
                        result = new GetPositionResult()
                        {
                            Success = true,
                            //CarsNames = carsNames,
                            Fp                = fp,
                            FromUrl           = fromUrl,
                            NotifyMsgs        = notifyMsgs,
                            WebSocketID       = webSocketID,
                            PlayerName        = playerName,
                            positionInStation = this._Players[getPosition.Key].positionInStation,
                            fPIndex           = this._Players[getPosition.Key].StartFPIndex
                        };
                    }
                    else
                    {
                        result = new GetPositionResult()
                        {
                            Success = false
                        }
                    };
                }
                else
                {
                    result = new GetPositionResult()
                    {
                        Success = false
                    };
                }
            }

            if (OpenMore == 0)
            {
                CheckAllPromoteState(getPosition.Key);
                CheckCollectState(getPosition.Key);
                sendCarAbilityState(getPosition.Key);
                sendCarStateAndPurpose(getPosition.Key);
            }
            else if (OpenMore > 0)
            {
                CheckAllPromoteState(getPosition.Key);
                CheckCollectState(getPosition.Key);

                sendCarAbilityState(getPosition.Key);
                sendCarStateAndPurpose(getPosition.Key);
            }
            return(result);
        }
예제 #33
0
        public Vector3 Unstuck(int multiplier)
        {
            Vector3 positionBehindMe = CalculatPositionnBehind(GetPosition.Invoke(), GetRotation(), 4);

            return(Seek(positionBehindMe, multiplier));
        }
예제 #34
0
파일: Tutorial.cs 프로젝트: Mothil93/Akiro
    void Start()
    {
        getPos = GetComponent<GetPosition>();

        isDone = false;
        resetTutorial = false;

        spawnObj = GameObject.Find("Spawner");
        spawner = spawnObj.GetComponent<Spawner>();

        CreateSpawnPos();

        CreateAndDeactivate();

        shrimps[number].SetActive(true);
        shrimps[number].transform.position = spawnPos;
    }
예제 #35
0
        /// <summary>
        /// 用于自己位置的初始化,实际上这个才是真正的初始化!在AddNewPlayer或者update以前,需要将self的others初始化
        /// </summary>
        /// <param name="getPosition">传入参数</param>
        /// <param name="fromUrl">返回的url</param>
        /// <param name="webSocketID">websocketID</param>
        /// <param name="fp">地点</param>
        /// <param name="carsNames"></param>
        /// <returns></returns>
        internal async Task <GetPositionResult> GetPosition(GetPosition getPosition)
        {
            GetPositionResult result;

            int OpenMore   = -1;//第一次打开?
            var notifyMsgs = new List <string>();

            lock (this.PlayerLock)
            {
                if (this._Players.ContainsKey(getPosition.Key))
                {
                    var fp          = Program.dt.GetFpByIndex(this._Players[getPosition.Key].StartFPIndex);
                    var fromUrl     = this._Players[getPosition.Key].FromUrl;
                    var webSocketID = this._Players[getPosition.Key].WebSocketID;
                    var carsNames   = this._Players[getPosition.Key].CarsNames;
                    var playerName  = this._Players[getPosition.Key].PlayerName;

                    /*
                     * 这已经走查过,在AddNewPlayer、UpdatePlayer时,others都进行了初始化
                     */
                    AddOtherPlayer(getPosition.Key, ref notifyMsgs);
                    this.brokenParameterT1RecordChanged(getPosition.Key, getPosition.Key, this._Players[getPosition.Key].brokenParameterT1, ref notifyMsgs);
                    GetAllCarInfomationsWhenInitialize(getPosition.Key, ref notifyMsgs);
                    //getAllCarInfomations(getPosition.Key, ref notifyMsgs);
                    OpenMore = this._Players[getPosition.Key].OpenMore;

                    var player = this._Players[getPosition.Key];
                    //var m2 = player.GetMoneyCanSave();

                    //    MoneyCanSaveChanged(player, m2, ref notifyMsgs);

                    SendPromoteCountOfPlayer("mile", player, ref notifyMsgs);
                    SendPromoteCountOfPlayer("business", player, ref notifyMsgs);
                    SendPromoteCountOfPlayer("volume", player, ref notifyMsgs);
                    SendPromoteCountOfPlayer("speed", player, ref notifyMsgs);

                    BroadCoastFrequency(player, ref notifyMsgs);
                    player.SetMoneyCanSave(player, ref notifyMsgs);

                    // player.RunSupportChangedF(ref notifyMsgs);
                    //player.this._Players[addItem.Key].SetMoneyCanSave = RoomMain.SetMoneyCanSave;
                    //MoneyCanSaveChanged(player, player.MoneyForSave, ref notifyMsgs);

                    SendMaxHolderInfoMation(player, ref notifyMsgs);

                    var players = this._Players;
                    foreach (var item in players)
                    {
                        if (item.Value.TheLargestHolderKey == player.Key)
                        {
                            player.TheLargestHolderKeyChanged(item.Key, item.Value.TheLargestHolderKey, item.Key, ref notifyMsgs);
                        }
                    }
                    var list = player.usedRoadsList;
                    for (var i = 0; i < list.Count; i++)
                    {
                        this.DrawSingleRoadF(player, list[i], ref notifyMsgs);
                    }

                    //this._Players[getPosition.Key];
                    this._Players[getPosition.Key].MoneyChanged(this._Players[getPosition.Key], this._Players[getPosition.Key].Money, ref notifyMsgs);

                    result = new GetPositionResult()
                    {
                        Success     = true,
                        CarsNames   = carsNames,
                        Fp          = fp,
                        FromUrl     = fromUrl,
                        NotifyMsgs  = notifyMsgs,
                        WebSocketID = webSocketID,
                        PlayerName  = playerName
                    };
                }
                else
                {
                    result = new GetPositionResult()
                    {
                        Success = false
                    };
                }
            }

            if (OpenMore == 0)
            {
                await CheckAllPromoteState(getPosition.Key);
                await CheckCollectState(getPosition.Key);
                await sendCarAbilityState(getPosition.Key);
                await sendCarStateAndPurpose(getPosition.Key);
                await TellOtherPlayerMyFatigueDegree(getPosition.Key);
                await TellMeOtherPlayersFatigueDegree(getPosition.Key);
                await TellMeOthersRightAndDuty(getPosition.Key);
            }
            else if (OpenMore > 0)
            {
                await CheckAllPromoteState(getPosition.Key);
                await CheckCollectState(getPosition.Key);
                await SendAllTax(getPosition.Key);

                await sendCarAbilityState(getPosition.Key);
                await sendCarStateAndPurpose(getPosition.Key);
                await TellOtherPlayerMyFatigueDegree(getPosition.Key);
                await TellMeOtherPlayersFatigueDegree(getPosition.Key);
                await TellMeOthersRightAndDuty(getPosition.Key);

                //   await sendPlayerFatigueDegree(getPosition.Key);
                //for(var i=0;i<)
                //AbilityChanged(player, car, ref notifyMsg, "business");
                //AbilityChanged(player, car, ref notifyMsg, "volume");
                //AbilityChanged(player, car, ref notifyMsg, "mile");
            }
            return(result);
        }
 private int GetCurrentRowIndex(GetPosition pos)
 {
     int curIndex = -1;
     for (int i = 0; i < InstalledAssembliesDataGrid.Items.Count; i++)
     {
         DataGridRow row = GetRowItem(i);
         DataGridCell cell = GetCell(row);
         if (row != null && cell != null && 
             GetMouseTargetRow(row, pos) && !GetMouseTargetRow(cell, pos))
         {
             curIndex = i;
             break;
         }
     }
     return curIndex;
 }