Exemplo n.º 1
0
 public void checkTargetValid(WindowBehavior loc)
 {
     if(currentTarget.Equals(loc))
     {
         currentState = States.SEARCH;
     }
 }
Exemplo n.º 2
0
    public void removeTarget(WindowBehavior t)
    {
        targetLocs.Remove (t);

        for(int i = 0; i < Director.instance.getEnemiesInUse().Count; i++)
        {
            EnemyScript e = Director.instance.getEnemiesInUse()[i].GetComponent<EnemyScript>();
            e.checkTargetValid(t);
        }
    }
Exemplo n.º 3
0
        void TitleBar_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var window = Window.GetWindow((DependencyObject)sender);

            if (window != null)
            {
                if (e.ClickCount == 2 && WindowBehavior.GetHasTitleBarMaximizeButton(window))
                {
                    if (window.WindowState == WindowState.Normal)
                    {
                        window.WindowState = WindowState.Maximized;
                    }
                    else
                    {
                        window.WindowState = WindowState.Normal;
                    }
                }
                else
                {
                    window.DragMove();
                }
            }
        }
Exemplo n.º 4
0
        private void ExecuteWindowBehavior(WindowBehavior behavior)
        {
            switch (behavior)
            {
            case WindowBehavior.MinimizeToTaskbar:
                this.WindowState   = System.Windows.WindowState.Minimized;
                this.ShowInTaskbar = true;
                break;

            case WindowBehavior.MinimizeToTray:
                this.WindowState   = System.Windows.WindowState.Minimized;
                this.ShowInTaskbar = false;
                if (App.Settings.NotifyOnTray)
                {
                    NotifyIcon.ShowBalloonTip("ByteFlood", "ByteFlood has been minimized to the traybar.", Hardcodet.Wpf.TaskbarNotification.BalloonIcon.Info);
                }
                break;

            case WindowBehavior.Exit:
                ignoreclose = false;
                break;
            }
        }
Exemplo n.º 5
0
    Vector3 searchFurthest()
    {
        Vector3 furthest = Vector3.zero;
        Vector3 furthestWithoutOccupant = Vector3.zero;

        Vector3 currentPos = transform.position;
        bool first = true;
        bool firstUnoccupied = true;

        List<WindowBehavior> targetLocs = LevelDirector.instance.getTargets ();
        foreach (WindowBehavior t in targetLocs)
        {
            if(nav.destination != null && !t.getEnemies().Contains(this))
            {
                if(first || firstUnoccupied)
                {
                    if(first)
                    {
                        furthest = t.transform.position;
                        currentTarget = t;
                        first = false;
                    }
                    else if(t.getEnemies().Count == 0)
                    {
                        furthestWithoutOccupant = t.transform.position;
                        currentTarget = t;
                        firstUnoccupied = false;
                    }
                }
                else if(firstUnoccupied && Vector3.Distance(currentPos, t.transform.position) > Vector3.Distance(currentPos, furthest))
                {
                    currentTarget = t;
                    furthest = t.transform.position;
                }
                else if(!firstUnoccupied && (t.getEnemies().Count == 0 )
                        && Vector3.Distance(currentPos, t.transform.position) > Vector3.Distance(currentPos, furthest))
                {
                    furthestWithoutOccupant = t.transform.position;
                    currentTarget = t;
                }
            }
        }

        currentTarget.addEnemy (this);
        if (!furthestWithoutOccupant.Equals (Vector3.zero))
        {
            return furthestWithoutOccupant;
        }

        return furthest;
    }
Exemplo n.º 6
0
    Vector3 searchAid()
    {
        Vector3 leastPeople = Vector3.zero;

        int currentPeopleCount = 0;
        bool first = true;

        List<WindowBehavior> targetLocs = LevelDirector.instance.getTargets ();
        foreach (WindowBehavior t in targetLocs)
        {

            if(nav.destination != null && !t.getEnemies().Contains(this))
            {
                if(first)
                {
                    if(t.getEnemies().Count > 0)
                    {
                        leastPeople = t.transform.position;
                        currentTarget = t;
                        currentPeopleCount = t.getEnemies().Count;
                        first = false;
                    }
                }
                else
                {
                    if(t.getEnemies().Count < currentPeopleCount)
                    {
                        leastPeople = t.transform.position;
                        currentTarget = t;
                        currentPeopleCount = t.getEnemies().Count;
                    }
                }
            }
        }

        if(leastPeople.Equals(Vector3.zero))
        {
            leastPeople = searchClosest();
        }

        currentTarget.addEnemy (this);
        return leastPeople;
    }