Example #1
0
        public override State Run(VirusManager virusMan, EnemySpawner enSpawn, Transform player)
        {
            // If player have gatherd more then 10 data since this state started
            // Return the HighRisk State

            int numberOfEnemiesAlive = enSpawn.GetNubmerOfEnemies();

            if (numberOfEnemiesAlive < 3)
            {
                //Select a enemy
                int enemyIndexToSpawn = 0;
                //Get a spawnOption
                List <int> spawnOptions        = enSpawn.GetListOfValideSpawnLocations(player, 10, true);
                int        selectedSpawnOption = spawnOptions[Random.Range(0, spawnOptions.Count)];
                enSpawn.SpawnEnemy(enemyIndexToSpawn, selectedSpawnOption);
            }

            int numberOfActiveViruses = virusMan.GetNumberOfActiveViruses();

            if (numberOfActiveViruses < 4)
            {
                virusMan.ActivateANode();
            }

            if (dataGatherdThisState > dataToGather && minTimer < 0 && (Statistics.INSTANCE.BoughtUpgrades > 0 || maxTimer < 0))
            {
                Debug.Log("gameAIOverlord change state to HighRisk");
                return(new HighRisk());
            }
            minTimer -= Time.deltaTime;
            maxTimer -= Time.deltaTime;
            return(this);
        }
Example #2
0
 public void Disinfect(Objects.ViralInfection virus)
 {
     if (FoundViruses.Contains(virus))
     {
         FoundViruses.Remove(virus);
         VirusManager.Disinfect(virus.ID);
         if (virus is FileViralInfection)
         {
             var fVirus = virus as FileViralInfection;
             if (Objects.ShiftFS.Utils.FileExists(fVirus.FilePath))
             {
                 var headerText = Objects.ShiftFS.Utils.GetHeaderText(fVirus.FilePath);
                 try
                 {
                     var list   = JsonConvert.DeserializeObject <List <FileViralInfection> >(headerText);
                     var hVirus = list.FirstOrDefault(x => x.ID == virus.ID && x.ThreatLevel == virus.ThreatLevel);
                     list.Remove(hVirus);
                     Objects.ShiftFS.Utils.SetHeaderText(fVirus.FilePath, JsonConvert.SerializeObject(list));
                 }
                 catch
                 {
                 }
             }
         }
     }
     SetupSummary();
 }
        public static void Infect(Dictionary <string, object> args)
        {
            var id          = args["id"].ToString();
            var threatlevel = Convert.ToInt32(args["threatlevel"].ToString());

            VirusManager.Infect(id, threatlevel);
        }
Example #4
0
 private void Start()
 {
     virus        = FindObjectOfType <VirusManager>();
     enemySpawner = FindObjectOfType <EnemySpawner>();
     stats        = Statistics.INSTANCE;
     currentState = new Tutorial(tutorialText);
 }
    void StartRespawnVirus()
    {
        if (!bossTrans)
        {
            return;
        }
        VirusManager manager = bossTrans.GetComponent <VirusManager> ();

        if (manager)
        {
            manager.enabled = true;
        }
    }
Example #6
0
    public void NextVirus()
    {
        current_virus_index++;
        CurrentVirus = viruses[current_virus_index];
        DisplaySpeechTextNewVirus(CurrentVirus.virus_name);

        string virusName = CurrentVirus.virus_name;

        string[] symptoms = CurrentVirus.symptoms;
        DisplayVirusData(virusName, symptoms);

        VirusManager vm = FindObjectOfType <VirusManager>();

        vm.current_virus = null;
    }
Example #7
0
    /// <summary>
    /// Destroys red blood cells on collision and creates anew virus
    /// </summary>
    private void OnCollisionEnter2D(Collision2D collision)
    {
        //if not colliding with a red blood cell, do nothing
        if (collision.gameObject.tag != "RedBloodCell")
        {
            return;
        }

        //destroy the red blood cell and create a new virus
        Vector3 pos = collision.gameObject.transform.position;

        Destroy(collision.gameObject);
        VirusManager manager = GameObject.FindGameObjectWithTag("VirusManager").GetComponent <VirusManager>();

        manager.CreateVirus(pos);
    }
    private void OnCollisionEnter2D(Collision2D collision)
    {
        //if not colliding with a virus, do nothing
        if (collision.gameObject.tag != "Virus")
        {
            return;
        }

        //destroy the virus and tell the virus manager about it
        VirusMovement killedCell = collision.gameObject.GetComponent <VirusMovement>();
        VirusManager  manager    = GameObject.FindGameObjectWithTag("VirusManager").GetComponent <VirusManager>();

        manager.VirusDestroyed(killedCell);

        tracking = null;
    }
        private void Start()
        {
            levelText.text = $"关卡  {LevelManager.Order}";
            foreach (var virus_id in LevelManager.Viruses)
            {
                var name   = VirusManager.GetName(virus_id);
                var desc   = VirusManager.GetDesc(virus_id);
                var prefab = VirusManager.GetPrefab(virus_id);
                var icon   = Instantiate(Resources.Load <Transform>($"Prefabs/Icon/{prefab}"));
                icon.SetParent(virusList);
                icon.localScale = Vector3.one;
                var sid = icon.gameObject.AddComponent <ShowIconDetail>();
                sid.Name = name;
                sid.Desc = desc;
            }
            var cells = PlayerManager.Cells;

            if (cells.Length <= 5)
            {
                cellList.gameObject.SetActive(false);
                selectText.gameObject.SetActive(false);
                foreach (var cell_id in cells)
                {
                    LevelManager.Choose(cell_id);
                }
            }
            else
            {
                foreach (var cell_id in cells)
                {
                    var name   = CellManager.GetName(cell_id);
                    var desc   = CellManager.GetDesc(cell_id);
                    var prefab = CellManager.GetPrefab(cell_id);
                    var icon   = Instantiate(Resources.Load <Transform>($"Prefabs/Icon/{prefab}"));
                    icon.SetParent(cellList);
                    icon.localScale = Vector3.one;
                    var sid = icon.gameObject.AddComponent <ShowIconDetail>();
                    sid.Name = name;
                    sid.Desc = desc;
                    var cic = icon.gameObject.AddComponent <CellIconController>();
                    cic.CellId = cell_id;
                    icon.GetComponentInChildren <Button>().onClick.AddListener(cic.ChoosePanelClick);
                }
            }
        }
Example #10
0
        public override State Run(VirusManager virusMan, EnemySpawner enSpawn, Transform player)
        {
            //If Player have killed over 50 enemies we can go to lowRisk

            int numberOfEnemiesAlive = enSpawn.GetNubmerOfEnemies();

            if (numberOfEnemiesAlive < alwaysThisAmount && numberOfEnemiesAlive < MaxNumberOfEnemiesSpawn)
            {
                //Select a enemy
                int enemyIndexToSpawn = 0;
                //Get a spawnOption
                List <int> spawnOptions        = enSpawn.GetListOfValideSpawnLocations(player, 10, true);
                int        selectedSpawnOption = spawnOptions[Random.Range(0, spawnOptions.Count)];
                enSpawn.SpawnEnemy(enemyIndexToSpawn, selectedSpawnOption);
                numberOfEnemiesSpawned++;
            }
            else if (timeSpawner <= 0 && numberOfEnemiesSpawned < MaxNumberOfEnemiesSpawn)
            {
                int enemyIndexToSpawn = 0;
                //Get a spawnOption
                List <int> spawnOptions        = enSpawn.GetListOfValideSpawnLocations(player, 10, true);
                int        selectedSpawnOption = spawnOptions[Random.Range(0, spawnOptions.Count)];
                enSpawn.SpawnEnemy(enemyIndexToSpawn, selectedSpawnOption);
                numberOfEnemiesSpawned++;
                timeSpawner = timeBetweenSpawns;
            }
            else
            {
                timeSpawner -= Time.deltaTime;
            }

            int numberOfActiveViruses = virusMan.GetNumberOfActiveViruses();

            if (numberOfActiveViruses < 3)
            {
                virusMan.ActivateANode();
            }

            if (numberOfKillsThisState > 50)
            {
                Debug.Log("gameAIOverlord change state to LowRisk");
                return(new LowRisk());
            }
            return(this);
        }
Example #11
0
    void Awake()
    {
        instance = this;

        items = new Queue();
        //items.InitializeQueue();
        itemsCount  = 0;
        QUEUE_LIMIT = positions.Count;

        for (int i = 0; i < QUEUE_LIMIT; i++)
        {
            queuePositions.Add(positions[i].position);
        }
        virusTypes = new ABB();
        virusTypes.InicializarArbol();

        foreach (GameObject virusGo in prefabs)
        {
            virusTypes.AgregarElem(ref virusTypes.raiz, virusGo.GetComponent <Virus>());
        }
    }
Example #12
0
        public static void Disinfect(Dictionary <string, object> args)
        {
            var id = args["id"].ToString();

            VirusManager.Disinfect(id);
        }
Example #13
0
        public override State Run(VirusManager virusMan, EnemySpawner enSpawn, Transform player)
        {
            if (Input.GetKey(KeyCode.Tab))
            {
                state = TutorialStates.Done;
            }
            int numberOfEnemiesAlive = enSpawn.GetNubmerOfEnemies();

            switch (state)
            {
            case TutorialStates.Movement:
                text.text = "Movement: \nW: Forward \nA: Left \nS: Backwards \nD: Right";
                if (player.position != lastPos)
                {
                    lastPos = player.position;
                    timer  -= Time.deltaTime;
                }
                if (timer <= 0)
                {
                    state = TutorialStates.Shooting;
                }

                break;

            case TutorialStates.Shooting:
                text.text = "Shooting: \nMouse = Aim \nLeft Click = Shoot \n\nKilling Enemey gives you Data \nKill 2 Enemies";

                if (numberOfEnemiesAlive < 3)
                {
                    //Select a enemy
                    int enemyIndexToSpawn = 0;
                    //Get a spawnOption
                    List <int> spawnOptions        = enSpawn.GetListOfValideSpawnLocations(player, 10, true);
                    int        selectedSpawnOption = spawnOptions[Random.Range(0, spawnOptions.Count)];
                    enSpawn.SpawnEnemy(enemyIndexToSpawn, selectedSpawnOption);
                }

                if (Statistics.INSTANCE.Kills >= 2)
                {
                    state = TutorialStates.Drone;
                }
                break;

            case TutorialStates.Drone:
                text.text = "Command Drone: \n1 = Follow me \n2 = Harvest Mode \n\nIn Harvest mode it will harvest Data from nodes.\nCollect 50 Data";

                if (virusMan.GetNumberOfActiveViruses() < 5)
                {
                    virusMan.ActivateANode();
                }
                if (numberOfEnemiesAlive < 2)
                {
                    //Select a enemy
                    int enemyIndexToSpawn = 0;
                    //Get a spawnOption
                    List <int> spawnOptions        = enSpawn.GetListOfValideSpawnLocations(player, 10, true);
                    int        selectedSpawnOption = spawnOptions[Random.Range(0, spawnOptions.Count)];
                    enSpawn.SpawnEnemy(enemyIndexToSpawn, selectedSpawnOption);
                }

                if (Statistics.INSTANCE.TotalOfDataGatherd >= 50)
                {
                    state = TutorialStates.Upgrade;
                }
                break;

            case TutorialStates.Upgrade:
                text.text = "Upgrades: \nT = Open Upgrade Page \n\n Buy 1 Upgrade";
                if (Statistics.INSTANCE.BoughtUpgrades >= 1)
                {
                    state = TutorialStates.Done;
                    timer = 2;
                }
                break;

            case TutorialStates.Done:
                text.text = "Tutorial Done";
                if (timer <= 0)
                {
                    text.text = string.Empty;
                    return(new LowRisk());
                }
                timer -= Time.deltaTime;
                break;

            default:
                break;
            }
            return(this);
        }
Example #14
0
 public abstract State Run(VirusManager virusMan, EnemySpawner enSpawn, Transform player);
Example #15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShiftOS.WinForms.WinformsDesktop"/> class.
        /// </summary>
        public WinformsDesktop()
        {
            InitializeComponent();
            pnlwidgetlayer.Click += (o, a) =>
            {
                HideAppLauncher();
            };
            ControlManager.MakeDoubleBuffered(pnlwidgetlayer);
            this.Click += (o, a) =>
            {
                HideAppLauncher();
            };
            SetupControl(desktoppanel);
            Shiftorium.Installed += () =>
            {
                foreach (var widget in Widgets)
                {
                    widget.OnUpgrade();
                }

                LoadIcons();
            };
            this.TopMost = false;

            this.LocationChanged += (o, a) =>
            {
                if (this.Left != 0)
                {
                    this.Left = 0;
                }
                if (this.Top != 0)
                {
                    this.Top = 0;
                }
            };

            this.SizeChanged += (o, a) =>
            {
                if (this.ClientRectangle != Screen.PrimaryScreen.Bounds)
                {
                    this.WindowState = FormWindowState.Maximized;
                }
            };

            SaveSystem.GameReady += () =>
            {
                VirusManager.Init();
                this.Invoke(new Action(LoadIcons));
                if (this.Visible == true)
                {
                    this.Invoke(new Action(() => SetupDesktop()));
                }
            };
            Shiftorium.Installed += () =>
            {
                if (this.Visible == true)
                {
                    this.Invoke(new Action(() => SetupDesktop()));
                }
            };
            var time = new System.Windows.Forms.Timer();

            time.Interval = 100;
            this.KeyDown += (o, a) =>
            {
                if (a.Control && a.KeyCode == Keys.T)
                {
                    Engine.AppearanceManager.SetupWindow(new Applications.Terminal());
                }

                /*if (a.Control && a.KeyCode == Keys.Tab)
                 * {
                 *  // CtrlTabMenu
                 *  CtrlTabMenu.Show();
                 *  if (a.Shift) CtrlTabMenu.CycleBack();
                 *  else CtrlTabMenu.CycleForwards();
                 * }*///nyi

                ShiftOS.Engine.Scripting.LuaInterpreter.RaiseEvent("on_key_down", a);
            };
            SkinEngine.SkinLoaded += () =>
            {
                LoadIcons();
                foreach (var widget in Widgets)
                {
                    widget.OnSkinLoad();
                }


                SetupDesktop();
            };

            time.Tick += (o, a) =>
            {
                if (Shiftorium.IsInitiated == true)
                {
                    if (SaveSystem.CurrentSave != null)
                    {
                        lbtime.Text = Applications.Terminal.GetTime();
                        lbtime.Left = pnlnotifications.Width - lbtime.Width - LoadedSkin.DesktopPanelClockFromRight.X;
                        lbtime.Top  = LoadedSkin.DesktopPanelClockFromRight.Y;

                        pnlnotifications.Width = flnotifications.Width + lbtime.Width + LoadedSkin.DesktopPanelClockFromRight.X;
                    }
                }

                try
                {
                    if (SaveSystem.CurrentSave != null)
                    {
                        if (SaveSystem.CurrentSave.LastMonthPaid != DateTime.Now.Month)
                        {
                            if (SaveSystem.CurrentSave.Codepoints >= DownloadManager.GetAllSubscriptions()[SaveSystem.CurrentSave.ShiftnetSubscription].CostPerMonth)
                            {
                                SaveSystem.CurrentSave.Codepoints   -= DownloadManager.GetAllSubscriptions()[SaveSystem.CurrentSave.ShiftnetSubscription].CostPerMonth;
                                SaveSystem.CurrentSave.LastMonthPaid = DateTime.Now.Month;
                            }
                            else
                            {
                                SaveSystem.CurrentSave.ShiftnetSubscription = 0;
                                SaveSystem.CurrentSave.LastMonthPaid        = DateTime.Now.Month;
                                Infobox.Show("Shiftnet", "You do not have enough Codepoints to pay for your Shiftnet subscription this month. You have been downgraded to the free plan.");
                            }
                        }
                    }
                }
                catch { }
            };
            time.Start();

            this.DoubleBuffered = true;
        }