Exemple #1
0
        public ExplorerWindow()
        {
            _explorerStates = DependencyInjectionContainer.GetService <ExplorerStates>();

            InitializeComponent();
            MannschaftskaempfeExplorer.SelectedItemChanged += ((object sender, MannschaftskaempfeExplorer.SelectedItemChangedEventArgs e) => { });
        }
Exemple #2
0
 void BeIdle()
 {
     if (timer > 2)
     {
         MyState = ExplorerStates.PATROL;
     }
 }
Exemple #3
0
 private void HandleMovement()
 {
     if (pathVectorList != null)
     {
         Vector3 targetPosition = pathVectorList[currentPathIndex];
         if (Vector3.Distance(transform.position, targetPosition) > 1f)
         {
             Vector3 moveDir        = (targetPosition - transform.position).normalized;
             float   distanceBefore = Vector3.Distance(transform.position, targetPosition);
             transform.position = transform.position + moveDir * speed * Time.deltaTime;
         }
         else
         {
             currentPathIndex++;
             if (currentPathIndex >= pathVectorList.Count)
             {
                 if (MyState == ExplorerStates.MARKING)
                 {
                     GameManager.Instance.RemoveSpot();
                     PathFinding.Instance.GetGrid().GetXY(new Vector3(target.transform.position.x, target.transform.position.y, 5), out int a, out int b);
                     Instantiate(mine, PathFinding.Instance.GetGrid().GetWorldPosition(a, b), Quaternion.identity);
                     Destroy(target);
                 }
                 StopMoving();
                 hasObjective = false;
                 MyState      = ExplorerStates.IDLE;
             }
         }
     }
 }
Exemple #4
0
 private void OnTriggerEnter2D(Collider2D col)
 {
     if (col.gameObject.tag == "Spot")
     {
         target  = col.gameObject;
         MyState = ExplorerStates.MARKING;
     }
 }
Exemple #5
0
 private void Mark()
 {
     StopMoving();
     if (target != null)
     {
         PathFinding.Instance.GetGrid().GetXY(new Vector3(target.transform.position.x, target.transform.position.y, 5), out int x, out int y);
         this.SetTargetPosition(PathFinding.Instance.GetGrid().GetWorldPosition(x, y));
         HandleMovement();
         // print("target is null");
     }
     else
     {
         hasObjective = false;
         MyState      = ExplorerStates.IDLE;
     }
 }
Exemple #6
0
 private void Start()
 {
     MyState = ExplorerStates.IDLE;
 }