Esempio n. 1
0
    void StateMachine(SearchStates searchStates, Vector3 allertedPosition)
    {
        if (movementStates == MovementStates.patrolling)
        {
            Patrolling();
        }
        if (searchStates == SearchStates.sawSomeone)
        {
            movementStates = MovementStates.chasing;

            Chasing(allertedPosition);
        }
        if (searchStates == SearchStates.idle)
        {
            movementStates = MovementStates.patrolling;
        }
        if (searchStates == SearchStates.heardSomething)
        {
            Searching(allertedPosition);
        }
        else
        {
            searchTimer = 0;
        }
    }
Esempio n. 2
0
    private void OnTriggerStay(Collider other)
    {
        if (other.tag == "Player")
        {
            Debug.DrawRay(transform.position, transform.forward);

            if (Vector3.Angle(transform.forward, other.transform.position - transform.position) < fieldOfView)
            {
                RaycastHit hit;

                if (Physics.Linecast(transform.position + Vector3.up, other.transform.position + Vector3.up / 2, out hit))
                {
                    if (hit.transform == other.transform)
                    {
                        allertedPosition = other.transform.position;
                        searchStates     = SearchStates.sawSomeone;

                        if (Vector3.Distance(transform.position, other.transform.position) < killDistance)
                        {
                            if (other.GetComponent <PhotonView>().IsMine == true)
                            {
                                GameManager.gameManager.Die(other.transform);
                            }
                        }
                    }
                }
            }
        }
        else
        {
            searchStates = SearchStates.idle;
        }
    }
Esempio n. 3
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Search"/> class.
 /// </summary>
 /// <param name="searchText">The text for which to search.</param>
 /// <param name="token">The unique search token.</param>
 /// <param name="state">The state of the search.</param>
 /// <param name="responseCount">The current number of responses received.</param>
 /// <param name="fileCount">The total number of files contained within received responses.</param>
 public Search(string searchText, int token, SearchStates state, int responseCount, int fileCount)
 {
     SearchText    = searchText;
     Token         = token;
     State         = state;
     ResponseCount = responseCount;
     FileCount     = fileCount;
 }
Esempio n. 4
0
        public void Instantiates_With_Expected_Data(string searchText, int token, SearchStates state, int responseCount, int fileCount)
        {
            var s = new Search(searchText, token, state, responseCount, fileCount);

            Assert.Equal(searchText, s.SearchText);
            Assert.Equal(token, s.Token);
            Assert.Equal(state, s.State);
            Assert.Equal(responseCount, s.ResponseCount);
            Assert.Equal(fileCount, s.FileCount);
        }
Esempio n. 5
0
    public void Update()
    {
        if (PhotonNetwork.IsMasterClient == false)
        {
            GetComponent <NavMeshAgent>().enabled = false;
            return;
        }

        navigation.Tick(searchStates, allertedPosition);

        searchStates = SearchStates.idle;
    }
Esempio n. 6
0
        private void SetSearchState(SearchStates searchState, bool isOnUiThread = false)
        {
            if (Context == null)
            {
                return;
            }
            if (!isOnUiThread)
            {
                Context.RunOnUiThread
                (
                    () => SetSearchState(searchState, true)
                );
                return;
            }
            SearchInfo.SearchState = searchState;
            SearchStateChangedEventArgs searchStateChangedEventArgs = new SearchStateChangedEventArgs(SearchInfo);

            Searching = searchStateChangedEventArgs.Searching;

            if (SearchStateChanged != null)
            {
                SearchStateChanged(this, searchStateChangedEventArgs);
            }
        }
Esempio n. 7
0
 /// <summary>
 ///     Completes the search with the specified <paramref name="state"/>.
 /// </summary>
 /// <param name="state">The terminal state of the search.</param>
 internal void Complete(SearchStates state)
 {
     SearchTimeoutTimer.Stop();
     State = SearchStates.Completed | state;
     TaskCompletionSource.SetResult(0);
 }
Esempio n. 8
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="SearchStateChangedEventArgs"/> class.
 /// </summary>
 /// <param name="previousState">The previous state of the client.</param>
 /// <param name="search">The search instance with which to initialize data.</param>
 internal SearchStateChangedEventArgs(SearchStates previousState, Search search)
     : base(search)
 {
     PreviousState = previousState;
 }
Esempio n. 9
0
 public SearchInformation(string query, SearchStates searchState)
 {
     Query       = query;
     SearchState = searchState;
 }
Esempio n. 10
0
 public SearchMessage(SearchStates searchState, DictionaryType dictionaryType, object result)
 {
     SearchState    = searchState;
     DictionaryType = dictionaryType;
     Result         = result;
 }
Esempio n. 11
0
 public void Tick(SearchStates searchStates, Vector3 allertedPosition)
 {
     antMotor.Tick(desiredPosition);
     StateMachine(searchStates, allertedPosition);
 }
Esempio n. 12
0
 /// <summary>
 ///     Completes the search with the specified <paramref name="state"/>.
 /// </summary>
 /// <param name="state">The terminal state of the search.</param>
 public void Complete(SearchStates state)
 {
     SearchTimeoutTimer.Stop();
     State = SearchStates.Completed | state;
     Completed?.Invoke(this, State);
 }
 private void rdbSales_CheckedChanged(object sender, EventArgs e)
 {
     UpdateSearchText("Search Sale No.");
     this.searchState = SearchStates.Sales;
 }
 private void radioButton3_CheckedChanged(object sender, EventArgs e)
 {
     UpdateSearchText("Search Alteration No.");
     this.searchState = SearchStates.Alteration;
 }
 private void radioButton2_CheckedChanged(object sender, EventArgs e)
 {
     UpdateSearchText("Search Customer Mobile No.");
     this.searchState = SearchStates.Customer;
 }
 private void radioButton1_CheckedChanged(object sender, EventArgs e)
 {
     UpdateSearchText("Search Order No.");
     this.searchState = SearchStates.Order;
 }