상속: MonoBehaviour
예제 #1
0
파일: EndMenu.cs 프로젝트: Ouzx/P0NG
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
         return;
     }
 }
예제 #2
0
    /// <summary>
    /// Disables components to disable and activate the spectator camera
    /// </summary>
    private void Die(string sourceID)
    {
        Debug.Log(transform.name + " is dead!");
        isDead = true;
        GetComponent <PlayerShoot>().CancelInvoke("Shoot");

        for (int i = 0; i < disableOnDeath.Length; i++)
        {
            disableOnDeath[i].enabled = false;
        }
        GetComponentInChildren <SkinnedMeshRenderer>().enabled = false;
        GetComponent <CharacterController>().enabled           = false;
        GetComponent <CapsuleCollider>().enabled = false;

        if (rightGunBone.transform.childCount > 0)
        {
            rightGunBone.transform.GetChild(0).gameObject.SetActive(false);
        }

        cam = GetComponentInChildren <Camera>().gameObject;
        cam.SetActive(false);

        sourcePlayer = GameManager.GetPlayer(sourceID);
        sourcePlayer.AddKill();

        if (hud)
        {
            hud.UpdateKills(kills);
        }


        if (isLocalPlayer)
        {
            // Show end menu
            endMenu = Instantiate(endMenuPrefab);
            endMenu.SetSourcePlayerName(sourcePlayer.playerName);
            GameMenu.lockCursor = false;

            if (isServer)
            {
                endMenu.DisableButtons();
            }

            sourcePlayer.GetComponent <PlayerController>().GetTpsCam().enabled = true;

            hud.gameObject.SetActive(false);
        }
    }
예제 #3
0
    void Start()
    {
        Application.runInBackground = true;
        s_instance   = this;
        player_pool  = new PoolSystem <GameObject>(ResourcesLoader.LoadResources <GameObject>("Prefabs/Player_model"), 4);
        bomb_pool    = new PoolSystem <GameObject>(ResourcesLoader.LoadResources <GameObject>("Prefabs/Bomb"), 100);
        pwr_up_pool  = new PoolSystem <GameObject>(ResourcesLoader.LoadResources <GameObject>("Prefabs/PowerUp"), 100);
        hud          = GameObject.Find("HUD").GetComponent <HUD>();
        m_MainCamera = GameObject.Find("MainCamera");
        mainMenu     = GameObject.Find("OrthoCamera").GetComponent <MainMenuScript>();
        mp           = GameObject.Find("MusicPlayer").GetComponent <MusicPlayer>();

        endmenu = GameObject.Find("EndMenu").GetComponent <EndMenu>();


        baseRotation  = m_MainCamera.transform.rotation;
        gravityStates = new Vector3[] { Vector3.up *const_gravity, Vector3.forward *const_gravity, Vector3.forward * -const_gravity, Vector3.right *const_gravity, Vector3.right * -const_gravity };
    }
예제 #4
0
    // Use this for initialization
    void Start()
    {
        oneUpSound   = GameObject.Find("OneUpSound");
        soundManager = FindObjectOfType <SoundManager>();
        pauseMenu    = FindObjectOfType <PauseMenu>();
        endMenu      = FindObjectOfType <EndMenu>();

        currentRound = 1;
        player1turn  = true;
        scorePlayer1 = 0;
        scorePlayer2 = 0;
        scoreColor   = 0;
        ballCount    = 0;
        scoreText    = GameObject.Find("ScoreText").GetComponent <Text>();
        UpdateScore();
        numberOfHit = 0;
        getGameInfo();

        isOnlineMode       = false;
        isHost             = true;
        isPlayer2Connected = false;
        aiMode             = false;

        pauseMenu.SetRestartGameAction(restartGame);
        pauseMenu.SetLeaveGameAction(LeaveGame);
        endMenu.SetRestartGameAction(restartGame);
        endMenu.SetLeaveGameAction(LeaveGame);

        GameObject keybindController = GameObject.FindGameObjectWithTag("KeybindController");

        if (keybindController != null)
        {
            keybindsMenu = keybindController.GetComponent <Keybind>();
        }

        GameObject avatarModifier = GameObject.FindGameObjectWithTag("Avatars");

        if (avatarModifier != null)
        {
            avatars = avatarModifier.GetComponent <Avatars>();
        }
        SpawnObstacles();
        material.color = Color.red;
    }
예제 #5
0
    void Awake()
    {
        instance = this;

        for (int i = 0; i < menu_window.Length; i++)
        {
            //Gets all rect transform and canvas group inside the windwo_menu array
            menu_rects.Add(menu_window [i].GetComponent <RectTransform> ());
            menu_canvases.Add(menu_window [i].GetComponent <CanvasGroup> ());
            //Centers all objects here
            menu_rects [i].offsetMax = menu_rects [i].offsetMin = Vector3.zero;
            //Makes all canvases invisible on awake
            menu_canvases [i].alpha = 0.0f;
            //menu_canvases [i].interactable = false;
            menu_window[i].SetActive(false);
        }

        menu_window [0].SetActive(true);
        menu_canvases [0].alpha        = 1.0f;
        menu_canvases [0].interactable = true;
        current_screen = 0;
    }
    private void Awake()
    {
        player         = GameObject.FindGameObjectWithTag("Player");
        playerCollider = player.GetComponent <BoxCollider2D>();

        drone = GameObject.FindGameObjectWithTag("Drone");

        HUD         = GameObject.FindGameObjectWithTag("HUD");
        hudTimeText = GameObject.FindGameObjectWithTag("TimeText").GetComponent <TextMeshProUGUI>();

        gameController = GameObject.FindGameObjectWithTag("GameController");

        levelDB = gameController.GetComponent <LevelDatabase>();

        mainMenu  = gameController.GetComponent <MainMenu>();
        levelMenu = gameController.GetComponent <LevelMenu>();
        pauseMenu = gameController.GetComponent <PauseMenu>();
        endMenu   = gameController.GetComponent <EndMenu>();

        cam = Camera.main;

        audioSource = player.GetComponent <AudioSource>();
    }
예제 #7
0
파일: Board.cs 프로젝트: Kynake/XO
    void Awake()
    {
        _boardSquares = new List <Square>(GetComponentsInChildren <Square>());

        _endMenu = endMenu.GetComponent <EndMenu>();
    }
예제 #8
0
 // Start is called before the first frame update
 void Start()
 {
     animator = GetComponent<Animator>();
     endMenu = FindObjectOfType<EndMenu>();
 }
예제 #9
0
 void Start()
 {
     m_Incl = 0.0f;
     m_Rot_Y = 0.0f;
     m_JumpHandler = GetComponentInChildren<JumperScript>();
     GameObject world = GameObject.Find("GameWorld");
     m_WorldHandler = world.GetComponent<WorldControllerScript>();
     Screen.showCursor = false;
     m_LocalGravityScript = gameObject.GetComponent<LocalGravityScript>();
     m_AttachToPlayer = GameObject.Find("Grabber").GetComponent<AttachToPlayerScript>();
     m_Camera = transform.FindChild("Camera").gameObject;
     Screen.lockCursor = true;
     m_goToLoad = new ArrayList();
     m_PlayerCollider = gameObject.collider;
     m_PauseMenu = gameObject.GetComponent<PauseMenu>();
     m_EndMenu = gameObject.GetComponent<EndMenu>();
     m_Hud = GameObject.Find("HUD").GetComponent<HudScript>();
 }