コード例 #1
0
ファイル: GameController.cs プロジェクト: votruongan/TATank
    IEnumerator WaitAndUpdateCamera()
    {
        yield return(new WaitForSeconds(0.2f));

        if (mainCamController == null)
        {
            mainCamController = GameObject.Find("MainCamera").GetComponent <CameraController>();
        }
        if (foreController == null)
        {
            foreController = GameObject.Find("Foreground").GetComponent <ForegroundController>();
        }
        mainCamController.UpdateClamp(foreController.bottomLeftPosition, foreController.topRightPosition);
    }
コード例 #2
0
    public void Awake()
    {
        //loveInterests = new List<LoveInterest>(GameObject.FindObjectsOfType<LoveInterest>());
        mansion = GameObject.FindObjectOfType <Mansion>();

        sfxManager           = GameObject.FindObjectOfType <SFXManager>();
        bgmManager           = GameObject.FindObjectOfType <BGMManager>();
        dialogControls       = GameObject.FindObjectOfType <DialogController>();
        mapControls          = GameObject.FindObjectOfType <MapController>();
        diaryControls        = GameObject.FindObjectOfType <DiaryController> ();
        timeUI               = GameObject.FindObjectOfType <TimeUI>();
        backgroundControls   = GameObject.FindObjectOfType <BackgroundController>();
        foregroundControls   = GameObject.FindObjectOfType <ForegroundController>();
        loveInterestControls = GameObject.FindObjectOfType <LoveInterestSelectController>();
        screenFader          = GameObject.FindObjectOfType <ScreenFader>();
        dayControls          = GameObject.FindObjectOfType <DayManager>();

        instance = this;
    }
コード例 #3
0
 // Start is called before the first frame update
 void Start()
 {
     dividedAngle   = 90 / verticesDivision;
     foreController = GameObject.Find("Foreground").GetComponent <ForegroundController>();
 }
コード例 #4
0
ファイル: GameController.cs プロジェクト: votruongan/TATank
    void Start()
    {
        // if (connector == null){
        //  connector = GameObject.Find("ConnectorManager").GetComponent<ConnectorManager>();
        // }
        instance = this;
        GameObject g = GameObject.Find("ConnectorManager");

        if (g == null)
        {
            connector.gameObject.SetActive(true);
            soundManager.gameObject.SetActive(true);
            GameObject.DontDestroyOnLoad(connector.gameObject);
            GameObject.DontDestroyOnLoad(soundManager.gameObject);
            isOnLocalTest = true;
        }
        else
        {
            connector    = g.GetComponent <ConnectorManager>();
            soundManager = GameObject.Find("SoundManager").GetComponent <SoundManager>();
        }
        connector.gameController = this;
        soundManager.PlayBGM("062");
        if (uiController == null)
        {
            uiController = GameObject.Find("UIController").GetComponent <UIController>();
            uiController.SetLoadingScreen(true);
        }
        try {
            playerIdCache = null;
            if (foreController == null)
            {
                Debug.Log("Finding bg: " + GameObject.Find("Foreground"));
                foreController = GameObject.Find("Foreground").GetComponent <ForegroundController>();
            }
            if (backgroundSprite == null)
            {
                Debug.Log("Finding bg: " + GameObject.Find("Background"));
                backgroundSprite = GameObject.Find("Background").GetComponent <SpriteRenderer>();
            }
            // no ExplosionController assigned
            if (explosionController == null)
            {
                try{
                    explosionController = GameObject.Find("ExplosionController").GetComponent <ExplosionController>();
                }
                catch (Exception e) {
                    Debug.Log("No explosionController : " + e.ToString());
                }
            }
            if (mainCamController == null)
            {
                mainCamController = GameObject.Find("MainCamera").GetComponent <CameraController>();
                mainCamController.UpdateClamp(foreController.bottomLeftPosition, foreController.topRightPosition);
            }
            if (minimapCamController == null)
            {
                minimapCamController = GameObject.Find("MinimapCamera").GetComponent <CameraController>();
            }
            if (countDownController == null)
            {
                countDownController = GameObject.Find("CountDownController").GetComponent <CountDownController>();
            }
            countDownController.ToggleObject(false);
            // no DigController assigned
            if (digController == null)
            {
                try{
                    digController = GameObject.Find("DigController").GetComponent <DigController>();
                }
                catch (Exception e) {
                    Debug.Log("No digController : " + e.ToString());
                }
            }
            foreach (PlayerInfo inf in connector.playerInfos)
            {
                // Debug.Log(inf);
                if (inf.team == 2)
                {
                    ((FightUIController)uiController).LoadBluePlayerPreview(inf);
                }
                else
                {
                    ((FightUIController)uiController).LoadRedPlayerPreview(inf);
                }
            }
            // if (isOnLocalTest){
            //  bool res = ConnectHost("127.0.0.1");
            //  if (res){
            //      StartMatch();
            //      // isOnLocalTest = false;
            //  }else{
            //      Debug.Log(" Cannot simulate login ");
            //  }
            // }
            Debug.Log("Fight Scene ");
        } catch (Exception e) {
            isOnLocalTest = false;
            Debug.Log("Not Fight Scene : " + e.ToString());
        }
        isStarted = true;
        connector.isSceneTransforming = false;
        Scene tmpScene = SceneManager.GetSceneByName("temp");

        if (tmpScene.IsValid())
        {
            SceneManager.UnloadSceneAsync("temp");
        }
        Debug.Log("[GameController] START DONE");
    }
コード例 #5
0
 private void Awake()
 {
     foreground = FindObjectOfType <ForegroundController>();
 }