Exemplo n.º 1
0
 public void RpcShowReport()
 {
     NewSpawner[] spawners = GameObject.FindObjectsOfType <NewSpawner>();
     if (spawners.Length > 0)
     {
         for (int i = 0; i < spawners.Length; i++)
         {
             spawners[i].isGameStart = false;
             GameMetricLogger.ShowPrintLog();
         }
     }
 }
Exemplo n.º 2
0
/***
 *    ███████╗███╗   ██╗██████╗      ██████╗  █████╗ ███╗   ███╗███████╗
 *    ██╔════╝████╗  ██║██╔══██╗    ██╔════╝ ██╔══██╗████╗ ████║██╔════╝
 *    █████╗  ██╔██╗ ██║██║  ██║    ██║  ███╗███████║██╔████╔██║█████╗
 *    ██╔══╝  ██║╚██╗██║██║  ██║    ██║   ██║██╔══██║██║╚██╔╝██║██╔══╝
 *    ███████╗██║ ╚████║██████╔╝    ╚██████╔╝██║  ██║██║ ╚═╝ ██║███████╗
 *    ╚══════╝╚═╝  ╚═══╝╚═════╝      ╚═════╝ ╚═╝  ╚═╝╚═╝     ╚═╝╚══════╝
 *
 */

    public void SetEndGameSession()
    {
        //if (!(this.endGameMenu.activeSelf || this.endGameMenu.activeInHierarchy)) {
        //}

        //this.endGameMenu.SetActive(true);
        this.initialMenu.SetActive(false);
        this.optionsMenu.SetActive(false);
        this.LANClientNotConnected.SetActive(false);
        this.LANClientNotReady.SetActive(false);
        this.LANClientReady.SetActive(false);
        this.LANHost.SetActive(false);
        this.unitAttributeEditor.SetActive(false);

        GameMetricLogger.SetGameLogger(GameLoggerOptions.StopGameMetrics);
        GameMetricLogger.ShowPrintLog();
    }
Exemplo n.º 3
0
        public void Update()
        {
            if (this.unitCount <= 0 && !this.startAIFlag && this.isSingleAIPlayer && this.hasLostTheGame)
            {
                if (!GameMetricLogger.instance.isShownToScreen)
                {
                    GameMetricLogger.ShowPrintLog();
                }
                return;
            }

            if (this.splitGroupList.Count > 0)
            {
                for (int i = 0; i < this.splitGroupList.Count; i++)
                {
                    SplitGroup splitGroup = this.splitGroupList[i];
                    if (splitGroup.elapsedTime > 1f)
                    {
                        this.splitGroupList.RemoveAt(i);
                        i--;
                    }
                    else
                    {
                        splitGroup.Update();
                        splitGroup.elapsedTime += Time.deltaTime;
                        this.splitGroupList[i]  = splitGroup;
                    }
                }
            }
            if (this.mergeGroupList.Count > 0)
            {
                for (int i = 0; i < this.mergeGroupList.Count; i++)
                {
                    MergeGroup mergeGroup = this.mergeGroupList[i];
                    if (mergeGroup.elapsedTime > 1f)
                    {
                        if (mergeGroup.owner != null)
                        {
                            AIUnit unit = mergeGroup.owner.GetComponent <AIUnit>();
                            unit.previousLevel = unit.level;
                            unit.level++;

                            //TODO: Use the attribute manager to manage the attributes after merging.
                            TierUpgrade tier = this.aiAttributeManager.tiers[unit.level - 1];

                            //float temp = unit.currentHealth;
                            unit.currentHealth = (int)tier.health;                          // (temp * tier.health);
                            //temp = unit.maxHealth;
                            unit.maxHealth = (int)tier.health;                              //(temp * tier.health);

                            unit.attackFactor         = tier.attack;
                            unit.mergeFactor          = tier.merge;
                            unit.attackCooldownFactor = tier.attackCooldown;
                            unit.splitFactor          = tier.split;
                            unit.mergeFactor          = tier.merge;
                            unit.speedFactor          = tier.speed;
                        }
                        if (mergeGroup.merge != null)
                        {
                            this.removeUnitList.Add(mergeGroup.merge.GetComponent <AIUnit>());
                        }
                        //MonoBehaviour.Destroy(mergeGroup.merge);
                        this.mergeGroupList.RemoveAt(i);
                        i--;
                    }
                    else
                    {
                        mergeGroup.Update();
                        mergeGroup.elapsedTime += Time.deltaTime;
                        this.mergeGroupList[i]  = mergeGroup;
                    }
                }
            }
            if (this.removeUnitList.Count > 0)
            {
                foreach (AIUnit unit in this.removeUnitList)
                {
                    if (unit != null)
                    {
                        MonoBehaviour.Destroy(unit.gameObject);
                    }
                }
                this.removeUnitList.Clear();
            }
            this.unitCount = this.unitContainer.transform.childCount;
        }
Exemplo n.º 4
0
        void Update()
        {
            if (!this.hasAuthority)
            {
                return;
            }
            if (this.minimapCamera == null)
            {
                return;
            }
            if (this.allObjects.Count <= 0)
            {
                if (!this.isDead)
                {
                    GameMetricLogger.ShowPrintLog();
                    AIManager.Instance.startAIFlag = false;
                    this.isDead = true;
                }
                return;
            }

            //This handles all the input actions the player has done in the minimap.
            this.screenPoint = Camera.main.ScreenToViewportPoint(Input.mousePosition);
            if (this.minimapCamera.rect.Contains(this.screenPoint) && Input.GetMouseButtonDown(1))
            {
                if (this.selectedObjects.Count > 0)
                {
                    float   mainX = (this.screenPoint.x - this.minimapCamera.rect.xMin) / (1.0f - this.minimapCamera.rect.xMin);
                    float   mainY = (this.screenPoint.y) / (this.minimapCamera.rect.yMax);
                    Vector3 minimapScreenPoint = new Vector3(mainX, mainY, 0f);
                    foreach (GameObject obj in this.selectedObjects)
                    {
                        GameUnit unit = obj.GetComponent <GameUnit>();
                        if (unit != null)
                        {
                            unit.CastRay(true, minimapScreenPoint, this.minimapCamera);
                        }
                    }
                }
            }
            else
            {
                if (this.minimapCamera.rect.Contains(this.screenPoint))
                {
                    return;
                }
                //This handles all the input actions the player has done to box select in the game.
                //Currently, it doesn't handle clicking to select.
                if (Input.GetMouseButtonDown(0))
                {
                    if (!(Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)))
                    {
                        ClearSelectObjects();
                    }
                    this.isSelecting  = true;
                    this.initialClick = Input.mousePosition;
                }
                else if (Input.GetMouseButtonUp(0))
                {
                    if (!(Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)))
                    {
                        ClearSelectObjects();
                    }
                    SelectObjectAtPoint();
                    SelectObjectsInRect();
                    SelectObjects();
                    this.isSelecting    = false;
                    this.isBoxSelecting = false;
                    this.initialClick   = -Vector3.one * 9999f;
                }
            }

            if (this.isSelecting && Input.GetMouseButton(0))
            {
                if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))
                {
                    this.isBoxSelecting = true;
                }
                this.selectionBox.Set(this.initialClick.x, Screen.height - this.initialClick.y, Input.mousePosition.x - this.initialClick.x, (Screen.height - Input.mousePosition.y) - (Screen.height - this.initialClick.y));
                if (this.selectionBox.width < 0)
                {
                    this.selectionBox.x     += this.selectionBox.width;
                    this.selectionBox.width *= -1f;
                }
                if (this.selectionBox.height < 0)
                {
                    this.selectionBox.y      += this.selectionBox.height;
                    this.selectionBox.height *= -1f;
                }
                TempRectSelectObjects();
            }

            foreach (GameObject obj in this.allObjects)
            {
                if (obj == null && !this.removeList.Contains(obj))
                {
                    this.removeList.Add(obj);
                }
            }

            for (int i = 0; i < this.selectedObjects.Count; i++)
            {
                if (this.selectedObjects[i] == null)
                {
                    this.selectedObjects.RemoveAt(i);
                }
            }

            if (this.removeList.Count > 0)
            {
                foreach (GameObject obj in this.removeList)
                {
                    if (this.allObjects.Contains(obj))
                    {
                        this.allObjects.Remove(obj);
                    }
                }
                foreach (GameObject obj in this.removeList)
                {
                    CmdDestroy(obj);
                }
                this.removeList.Clear();
            }
        }