Ejemplo n.º 1
0
        void Start()
        {
            this.restartController = new RestartController(this, this.dataCenter, this.inputProviderPlayer1);

            movementeControllerPlayer1 = new MovementController(this.inputProviderPlayer1, this.moverPlayer1, this);
            movementeControllerPlayer2 = new MovementController(this.inputProviderPlayer2, this.moverPlayer2, this);

            shootControllerPlayer1 = new ShootController(inputProviderPlayer1, dataCenter.fireRate, dataCenter.laser1,
                                                         dataCenter.ship1, this);

            shootControllerPlayer2 = new ShootController(inputProviderPlayer2, dataCenter.fireRate, dataCenter.laser2,
                                                         dataCenter.ship2, this);

            defenseControllerPlayer1 = new DefenseController(inputProviderPlayer1, dataCenter.ship1, dataCenter.tower1,
                                                             dataCenter.barrier1, dataCenter.towerPrice, dataCenter.barrierPrice, dataCenter.pointPlayer1, this);

            defenseControllerPlayer2 = new DefenseController(inputProviderPlayer2, dataCenter.ship2, dataCenter.tower2,
                                                             dataCenter.barrier2, dataCenter.towerPrice, dataCenter.barrierPrice, dataCenter.pointPlayer2, this);
            ///--------------------------------------------------------------------------------------------------
            ///Criadas por Lael
            this.colliderControllerPlayer1 = new ColliderController(this.dataCenter.colliderCheckerPlayer1, this.dataCenter.lifePlayer1, this.pointsPlayer2, this);
            this.colliderControllerPlayer2 = new ColliderController(this.dataCenter.colliderCheckerPlayer2, this.dataCenter.lifePlayer2, this.pointsPlayer1, this);
            this.gameOverController        = new GameOverController(this.dataCenter.lifePlayer1, this.dataCenter.lifePlayer2, this);
            ///--------------------------------------------------------------------------------------------------

            this.guiControllerPlayer1 = new GUIController(dataCenter.guiContainerPlayer1.points, dataCenter.guiContainerPlayer1.healh,
                                                          dataCenter.pointPlayer1, dataCenter.lifePlayer1, this);

            this.guiControllerPlayer2 = new GUIController(dataCenter.guiContainerPlayer2.points, dataCenter.guiContainerPlayer2.healh,
                                                          dataCenter.pointPlayer2, dataCenter.lifePlayer2, this);
        }
Ejemplo n.º 2
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
 }
Ejemplo n.º 3
0
    void Start()
    {
        Camera        = GameObject.FindGameObjectWithTag("MainCamera");
        Background    = GameObject.FindGameObjectWithTag("Background");
        rb            = GetComponent <Rigidbody2D>();
        animator      = GetComponent <Animator>();
        groundChecked = transform.Find("GroundCheckPoint");
        lastY         = 0;

        GameObject        restart = GameObject.Find("RestartController");
        RestartController other   = (RestartController)restart.GetComponent(typeof(RestartController));
        //other.gameActive = true;
    }
Ejemplo n.º 4
0
        private void Awake()
        {
            GetMainScript = this;

            //Ссылка на объект Меню UI
            GameObject menuPanel = GameObject.FindGameObjectWithTag("MenuPanel");

            //Ссылка на объект Счета-Очков UI
            GameObject scoreObj = GameObject.FindGameObjectWithTag("ScoreObject");

            //Ссылка на объект Рестарт UI
            GameObject restartObj = GameObject.FindGameObjectWithTag("RestartObject");

            //Ссылка на объект Таймер UI
            GameObject timerObj = GameObject.FindGameObjectWithTag("TimerObject");

            //Создаем списки положительных и отрицательных объектов, загружаем префабы
            List <GameObject> PositiveObjects = new List <GameObject>(Resources.LoadAll <GameObject>("Prefabs/PosPrefabs"));
            List <GameObject> NegativeObjects = new List <GameObject>(Resources.LoadAll <GameObject>("Prefabs/NegPrefabs"));

            //Создаем контроллеры
            menuAnimController = new MenuAnimationController(menuPanel);
            primInstController = new PrimitiveInstantiateController(PositiveObjects, NegativeObjects, timerObj);
            scoreController    = new ScoreController(scoreObj);
            pauseController    = new PauseController();
            restartController  = new RestartController(restartObj);

            #region Добавляем контроллеры в коллекцию

            AllControllers.Add(menuAnimController);
            AllControllers.Add(primInstController);
            AllControllers.Add(scoreController);
            AllControllers.Add(pauseController);
            AllControllers.Add(restartController);

            #endregion
        }
Ejemplo n.º 5
0
 public void setRestartController(RestartController restartController)
 {
     this.restartController = restartController;
 }
    void Awake()
    {
        instance = this;

        //shareButton = transform.GetChild(0).GetComponent<Button>();
        restartButton = transform.GetChild(1).GetComponent<Button>();
        //videoButton = transform.GetChild(2).GetComponent<Button>();

        //shareButton.onClick.AddListener(ShareButtonCallback);
        restartButton.onClick.AddListener(RestartButtonCallback);
        //videoButton.onClick.AddListener(VideoButtonCallback);

        //leftBtnRectTrans = videoButton.GetComponent<RectTransform>();
        centerBtnRectTrans = restartButton.GetComponent<RectTransform>();
        //rightBtnRectTrans = shareButton.GetComponent<RectTransform>();
    }