コード例 #1
0
 // Use this for initialization
 void Start()
 {
     nodeController = GetComponent <NodeController>();
     trapController = GetComponent <TrapController>();
     uiController   = GameObject.Find("In-game UI").GetComponent <UI_Controller>();
     loader         = GameObject.Find("SceneManager").GetComponent <SceneLoader>();
 }
コード例 #2
0
 void Update()
 {
     if (GameManager.Get().HabilitarMovimiento)
     {
         GameManager.Get().HabilitarMovimiento = false;
         mover = true;
         restaurarMovimiento = true;
     }
     if (Time.timeScale != 0)
     {
         altitud = transform.position.y;
         UI_Controller.Get().puntos = puntos;
         if (mover)
         {
             UI_Controller.Get().ContarTiempo();
             UI_Controller.Get().altitudJugador             = altitud;
             UI_Controller.Get().gasolinaJugador            = gasolina;
             UI_Controller.Get().velocidadHorizontalJugador = contadorH;
             UI_Controller.Get().velocidadVerticalJugador   = contadorV;
             if (restaurarMovimiento)
             {
                 RestaurarMovimiento();
                 restaurarMovimiento = false;
             }
             Movimiento();
         }
         CamaraAterrizaje();
     }
 }
コード例 #3
0
ファイル: Button_Forwarding.cs プロジェクト: Belfaust/Verdanc
 public void World_Map(Button thisButton)
 {
     uI_Controller = GameObject.FindObjectOfType <UI_Controller>();
     thisButton.onClick.AddListener(uI_Controller.World_Map_Button);
     Mouse_Controller._Instance.CursorPrefab.GetComponent <Image>().sprite = cursor;
     Mouse_Controller._Instance.CurrentlySelectedBuilding = null;
 }
コード例 #4
0
ファイル: GameController.cs プロジェクト: benpm/cse389_game
 // Start is called before the first frame update
 void Start()
 {
     Application.targetFrameRate = 60;
     audioSource        = GetComponent <AudioSource>();
     playerBulletSystem = transform.Find("PlayerBulletSystem").GetComponent <BulletSystem>();
     enemyBulletSystem  = transform.Find("EnemyBulletSystem").GetComponent <BulletSystem>();
     cam = transform.Find("Main Camera").GetComponent <Camera>();
     //train = FindObjectOfType<Train>();
     levelProperties = FindObjectOfType <LevelProperties>();
     ui = GetComponentInChildren <UI_Controller>();
     // Load audio clip resources
     audioClips = new Dictionary <string, AudioClip>();
     AudioClip[] clips = Resources.LoadAll <AudioClip>("Sound");
     foreach (AudioClip clip in clips)
     {
         audioClips.Add(clip.name, clip);
         Debug.LogFormat("loaded audio resource {0}", clip.name);
     }
     // Make sure we found everything we need
     Debug.Assert(cam, "Cannot find Main Camera");
     Debug.Assert(playerBulletSystem, "Cannot find PlayerBulletSystem");
     Debug.Assert(enemyBulletSystem, "Cannot find EnemyBulletSystem");
     Debug.Assert(ui, "Cannot find UI_Controller");
     Debug.Assert(audioSource);
 }
コード例 #5
0
    private void FindNearestEnemy()
    {
        float shortestDistance = Mathf.Infinity;
        int   index            = 0;

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

            if (Vector3.Distance(transform.position, enemies[i].position) < shortestDistance)
            {
                shortestDistance = Vector3.Distance(transform.position, enemies[i].position);
                index            = i;
            }
        }

        if (enemies.Count == 0)
        {
            // Игрок победил
            UI_Controller ui_controller = FindObjectOfType <UI_Controller>();
            ui_controller?.ShowPanel(true);
        }
        else
        {
            target = enemies[index];
        }
    }
コード例 #6
0
 // Use this for initialization
 public void Jugar()
 {
     Time.timeScale = 1;
     if (GameManager.Get() != null)
     {
         GameManager.Get().EnCreditos = false;
         GameManager.Get().pantallaCarga.SetActive(true);
         CargarNivel.Get().carga = 0;
     }
     SceneManager.LoadScene("Nivel 1");
     if (GameManager.Get() != null)
     {
         if (GameManager.Get().JuegoEmpezado)
         {
             Debug.Log("Entre");
             CargarNivel.Get().NumeroNivel   = 1;
             UI_Controller.Get().segundos    = 0;
             UI_Controller.Get().minutos     = 0;
             UI_Controller.Get().puntos      = 0;
             GameManager.Get().nivelActual   = 3;
             PlayerController.Get().velCaida = 0;
             PasarNivel();
         }
     }
 }
コード例 #7
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
コード例 #8
0
    private void Start()
    {
        // Reference to the UI_Controller script
        uiController    = GameObject.Find("UI_Controller").GetComponent <UI_Controller>();
        playerInventory = GetComponent <Player_Inventory>();

        // Setting the pickup item text objects
        pickupFood       = uiController.pickupFood;
        pickupOxygenTank = uiController.pickupOxygenTank;
        pickupPowerCell  = uiController.pickupPowerCell;

        pickupFireExt = uiController.pickupFireExt;
        pickupHammer  = uiController.pickupHammer;
        pickupPipe    = uiController.pickupPipe;
        pickupSpanner = uiController.pickupSpanner;
        pickupSpring  = uiController.pickupSpring;

        invFoodFull   = uiController.invFoodFull;
        invPowerFull  = uiController.invPowerFull;
        invOxygenFull = uiController.invOxygenFull;

        invExtFull     = uiController.invExtFull;
        invHammerFull  = uiController.invHammerFull;
        invPipeFull    = uiController.invPipeFull;
        invSpannerFull = uiController.invSpannerFull;
        invSpringFull  = uiController.invSpringFull;
    }
コード例 #9
0
ファイル: PatternEnd.cs プロジェクト: ktyldev/may-game-jam
 void Awake()
 {
     PatternComplete = new UnityEvent();
     _ship           = this.Find <ShipMovement>(GameTags.Player);
     _score          = this.Find <Score>(GameTags.Score);
     _ui             = this.Find <UI_Controller>(GameTags.IG_GUI);
 }
コード例 #10
0
ファイル: Player_Fix.cs プロジェクト: Natalo77/strandedcode
    // Use this for initialization
    void Start()
    {
        //gameObject.GetComponent<Player_HUD>().showFix();

        playerInventory = GetComponent <Player_Inventory>();
        uiController    = GameObject.Find("UI_Controller").GetComponent <UI_Controller>();

        fixEngine      = uiController.fixEngine;
        fixLifeSupport = uiController.fixLifeSupport;
        fixReactor     = uiController.fixReactor;
        fixControls    = uiController.fixControls;
        fixBattery     = uiController.fixBattery;

        reqExt     = uiController.reqExt;
        reqHammer  = uiController.reqHammer;
        reqPipe    = uiController.reqPipe;
        reqSpanner = uiController.reqSpanner;
        reqSpring  = uiController.reqSpring;

        engineFixed      = uiController.engineFixed;
        lifeSupportFixed = uiController.lifeSupportFixed;
        reactorFixed     = uiController.reactorFixed;
        controlsFixed    = uiController.controlsFixed;
        batteryFixed     = uiController.batteryFixed;
    }
コード例 #11
0
 // Update is called once per frame
 void Update()
 {
     if (UI_Controller.Get().buenAterrizaje == true)
     {
         aterrizajeConseguido.SetActive(true);
         aterrizajeFallido.SetActive(false);
     }
     if (UI_Controller.Get().buenAterrizaje == false)
     {
         aterrizajeFallido.SetActive(true);
         aterrizajeConseguido.SetActive(false);
     }
     if (GameManager.Get().tipoTextoPuntaje == 0)
     {
         textPuntaje.text = "          ";
     }
     if (GameManager.Get().tipoTextoPuntaje == 1)//puntaje x2
     {
         textPuntaje.text = "60 Puntos";
     }
     if (GameManager.Get().tipoTextoPuntaje == 2)//puntaje x3
     {
         textPuntaje.text = "90 Puntos";
     }
     if (GameManager.Get().tipoTextoPuntaje == 3)//puntaje x4
     {
         textPuntaje.text = "180 Puntos";
     }
     if (GameManager.Get().tipoTextoPuntaje == 4)//puntaje x5
     {
         textPuntaje.text = "250 Puntos";
     }
 }
コード例 #12
0
    private void HandleOnRetry()
    {
        PoolManager.instance.ResetPoolObjects(ObjectTypes.Boss1Bullet);
        PoolManager.instance.ResetPoolObjects(ObjectTypes.PlayerBullet);

        UI_Controller  currentUiCtrl = uiMng.GetCurrentUIController();
        UIMenu_EndGame endGamePanel  = currentUiCtrl.GetMenu <UIMenu_EndGame>();

        endGamePanel.RetryButtonPressed -= HandleOnRetry;

        uiMng.SetDefaultController();
        uiMng.GetCurrentUIController().SetCurrentMenu <UIMenu_Loading>();

        Scene sceneToReload = new Scene();
        Scene swarmScene    = new Scene();

        for (int i = 0; i < SceneManager.sceneCount; i++)
        {
            Scene currentScene = SceneManager.GetSceneAt(i);
            if (currentScene.name == "Swarm")
            {
                swarmScene = currentScene;
            }
            else
            {
                sceneToReload = currentScene;
            }
        }

        SceneManager.SetActiveScene(swarmScene);
        SceneManager.sceneUnloaded += HandleOnSceneUnloaded;
        SceneManager.UnloadSceneAsync(sceneToReload);
    }
コード例 #13
0
    // Start is called before the first frame update
    void Awake()
    {
        trackCtrl = GetComponent <TrackController>();
        uiCtrl    = GetComponent <UI_Controller>();
        logCtrl   = GetComponent <Log_Controller>();

        logCtrl.StartLogging();
    }
コード例 #14
0
    /// <summary>
    /// Funzione di Setup
    /// </summary>
    /// <param name="_gm"></param>
    public void Setup(GameManager _gm)
    {
        gm            = _gm;
        currentUICtrl = defaultUICtrl;
        currentUICtrl.Setup(gm);

        Init();
    }
コード例 #15
0
ファイル: UI_Controller.cs プロジェクト: Jashma/Battle-Robots
 void Awake()
 {
     name = "UI";
     DontDestroyOnLoad(gameObject);
     Instance = this;
     DisableAllMenu(); //DisableAllMenu
     ChangeState(8);   //MainMenu
 }
コード例 #16
0
    public void OnConstructionButtonPress()
    {
        ResetBuildWindows(_constructButtonPanelOpen);

        _constructButtonPanelOpen = !_constructButtonPanelOpen;

        UI_Controller.SwitchToWindowView(_constructButtonPanelOpen, "Build", "ConstructionOptions");
    }
コード例 #17
0
    public void OnZoneButtonPress()
    {
        ResetBuildWindows(_zoneButtonPanelOpen);

        _zoneButtonPanelOpen = !_zoneButtonPanelOpen;

        UI_Controller.SwitchToWindowView(_zoneButtonPanelOpen, "Build", "ZoneOptions");
    }
コード例 #18
0
ファイル: LevelManager.cs プロジェクト: ClearDimaS/SneakyGuy
 public static void LoseGame()
 {
     if (isLost == false)
     {
         OnGameOver?.Invoke();
         UI_Controller.SetActivePanel(UI_Controller.UI_Element.LoseGamePanel);
     }
     isLost = true;
 }
コード例 #19
0
    private void OnCollisionEnter(Collision collision)
    {
        if (mover && GameManager.Get().JuegoTerminado == false)
        {
            //var fwdSpeed = Vector3.Dot(rig.velocity, transform.forward);
            float auxVel = collision.relativeVelocity.magnitude;//con esta linea obtengo la velocidad del objeto segun la magnitud de su movimiento
            //(yo me entiendo).



            if (collision.gameObject.tag == "x2" && (int)auxVel <= velAterrizaje && this.gameObject.tag == "Jugador")
            {
                Quieto();
                GameManager.Get().tipoTextoPuntaje = 1;
                UI_Controller.Get().buenAterrizaje = true;
                GameManager.Get().pantallaAterrizaje.SetActive(true);
                mover  = false;
                puntos = puntos + 60;
            }
            if (collision.gameObject.tag == "x3" && (int)auxVel <= velAterrizaje && this.gameObject.tag == "Jugador")
            {
                Quieto();
                GameManager.Get().tipoTextoPuntaje = 2;
                UI_Controller.Get().buenAterrizaje = true;
                GameManager.Get().pantallaAterrizaje.SetActive(true);

                mover  = false;
                puntos = puntos + 90;
            }
            if (collision.gameObject.tag == "x4" && (int)auxVel <= velAterrizaje && this.gameObject.tag == "Jugador")
            {
                Quieto();
                GameManager.Get().tipoTextoPuntaje = 3;
                UI_Controller.Get().buenAterrizaje = true;
                GameManager.Get().pantallaAterrizaje.SetActive(true);
                mover  = false;
                puntos = puntos + 180;
            }
            if (collision.gameObject.tag == "x5" && (int)auxVel <= velAterrizaje && this.gameObject.tag == "Jugador")
            {
                Quieto();
                GameManager.Get().tipoTextoPuntaje = 4;
                UI_Controller.Get().buenAterrizaje = true;
                GameManager.Get().pantallaAterrizaje.SetActive(true);
                mover  = false;
                puntos = puntos + 250;
            }
            if ((collision.gameObject.tag == "ZonaMuerte") || (collision.gameObject.tag == "x2" && (int)auxVel > velAterrizaje) || (collision.gameObject.tag == "x3" && (int)auxVel > velAterrizaje) || (collision.gameObject.tag == "x4" && (int)auxVel > velAterrizaje) || (collision.gameObject.tag == "x5" && (int)auxVel > velAterrizaje))
            {
                Quieto();
                mover = false;
                UI_Controller.Get().buenAterrizaje = false;
                GameManager.Get().pantallaAterrizaje.SetActive(true);
                GameManager.Get().tipoTextoPuntaje = 0;
            }
        }
    }
コード例 #20
0
    public void OnBuildButtonPress()
    {
        ResetWindows();

        _buildButtonPanelOpen = !_buildButtonPanelOpen;
        BuildingManager.Instance.inBuildingMode = _buildButtonPanelOpen;

        UI_Controller.ToggleWindowViewWithReset(_buildButtonPanelOpen, "Build", "BuildOptions");
    }
コード例 #21
0
    public void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }

        SetActivePanel(0);
    }
コード例 #22
0
    public override void Enter()
    {
        uiMng         = context.GetGameManager().GetUIManager();
        currentUICtrl = uiMng.GetCurrentUIController();

        mainMenuPanel = currentUICtrl.GetMenu <UIMenu_MainMenu>();
        currentUICtrl.SetCurrentMenu <UIMenu_MainMenu>();

        mainMenuPanel.StartButtonPressed += HandleStartButtonPressed;
    }
コード例 #23
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != null)
     {
         Destroy(gameObject);
     }
 }
コード例 #24
0
 private void Awake() // 싱글턴 구성
 {
     if (ui_instance == null)
     {
         ui_instance = this; // null이라면 자기자신을 할당
     }
     else
     {
         // 씬에 두개 이상의 Gamemanager이 존재하므로 자기 자신 제거.
         Destroy(gameObject);
     }
 }
コード例 #25
0
ファイル: GameEndGameState.cs プロジェクト: supernikx/YLEM
    public override void Enter()
    {
        gm            = context.GetGameManager();
        groupCtrl     = gm.GetLevelManager().GetGroupController();
        uiMng         = context.GetGameManager().GetUIManager();
        currentUICtrl = uiMng.GetCurrentUIController();
        endGamePanel  = currentUICtrl.GetMenu <UIMenu_EndGame>();

        endGamePanel.RetryButtonPressed += HandleRetryButtonPressed;

        groupCtrl.Enable(false);
        currentUICtrl.SetCurrentMenu <UIMenu_EndGame>();
    }
コード例 #26
0
    private void CharacterDeath()
    {
        GameObject effect = Instantiate(deathEffect, transform.position, Quaternion.identity);

        Destroy(effect, 5.0f);
        Destroy(gameObject, 0.25f);

        // Отобразить UI проигрыша
        if (isPlayer)
        {
            UI_Controller ui_controller = FindObjectOfType <UI_Controller>();
            ui_controller?.ShowPanel();
        }
    }
コード例 #27
0
ファイル: UI_Controller.cs プロジェクト: Belfaust/Verdanc
 private void Start()
 {
     if (_Instance != null)
     {
         Debug.Log("Err there are 2 instances of UI Controllers");
         Destroy(this);
     }
     else
     {
         _Instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     UpdateResources();
     TimeText.text = "0";
 }
コード例 #28
0
 // Start is called before the first frame update
 void Start()
 {
     monedas            = 0;
     scriptUI           = UI.GetComponent <UI_Controller>();
     _box               = transform.GetComponent <BoxCollider2D>();
     _rigidbody         = GetComponent <Rigidbody2D>();
     _animator          = GetComponent <Animator>();
     _weapon            = GetComponentInChildren <Weapon>();
     _renderer          = GetComponent <Renderer>();
     _original          = _renderer.material.color;
     _box               = GetComponent <BoxCollider2D>();
     health             = Max_health;
     inmunnity          = gameObject.AddComponent <Timer>();
     inmunnity.Duration = 0.5f;
     inmunnity.Run();
     _facingRight = true;
     scriptUI.setVida((int)Max_health);
 }
コード例 #29
0
    private void HandleOnGroupDead()
    {
        groupCtrl.Enable(false);
        PoolManager.instance.ResetPoolObjects(ObjectTypes.Boss1Bullet);
        PoolManager.instance.ResetPoolObjects(ObjectTypes.PlayerBullet);

        UI_Controller  currentUiCtrl = uiMng.GetCurrentUIController();
        UIMenu_EndGame endGamePanel  = currentUiCtrl.GetMenu <UIMenu_EndGame>();

        if (endGamePanel != null)
        {
            endGamePanel.RetryButtonPressed += HandleOnRetry;
            currentUiCtrl.SetCurrentMenu <UIMenu_EndGame>();
        }
        else
        {
            HandleOnRetry();
        }
    }
コード例 #30
0
ファイル: PlayerControl.cs プロジェクト: David-Kor/Molaing
    void Start()
    {
        inventoryActive = false;
        isDelay         = false;
        isAttackable    = true;
        controllable    = true;
        status          = GetComponent <PlayerStatus>();
        playerMove      = GetComponent <PlayerMove>();
        playerAnimation = GetComponentInChildren <PlayerAnimation>();
        playerAttack    = GetComponentInChildren <PlayerAttack>();
        playerSkill     = GetComponentInChildren <PlayerSkill>();
        ui              = Camera.main.GetComponent <UI_Controller>();
        moveDirection   = Vector2.zero;
        spriteDirection = Vector2.down;
        firstDirection  = Vector2.zero;

        //플레이어와 적 간의 물리적 충돌 무시 (밀림현상 방지)
        Physics2D.IgnoreLayerCollision(LayerMask.NameToLayer("Player"), LayerMask.NameToLayer("Enemy"), true);
    }