Inheritance: NetworkBehaviour
コード例 #1
0
ファイル: Ship.cs プロジェクト: shadowfalI/MissileAttack
 void Start()
 {
     m_Transform      = gameObject.GetComponent <Transform>();
     m_MissileManager = GameObject.Find("MissileManager").GetComponent <MissileManager>();
     Nuke             = Resources.Load <GameObject>("Nuke");//特效
     m_GameUIManager  = GameObject.Find("UI Root").GetComponent <GameUIManager>();
 }
コード例 #2
0
    void Start()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            return;
        }
        XText  = transform.Find("XRateText").GetComponent <Text>();
        YText  = transform.Find("YRateText").GetComponent <Text>();
        ZText  = transform.Find("ZRateText").GetComponent <Text>();
        canvas = this.gameObject;
        Random.InitState(65819200);

        foreach (GameObject obj in GameRuleManager.Instance().GetBalls())
        {
            CreateHanger(obj, BallImage, new Vector3(0.6f, 0.6f, 0.6f));
        }

        foreach (GameObject obj in GameRuleManager.Instance().GetGoals())
        {
            CreateHanger(obj, GoalImage, new Vector3(1, 1.5f, 1));
        }

        foreach (GameObject obj in GameRuleManager.Instance().GetWalls())
        {
            CreateHanger(obj, WallImage[Random.Range(0, WallImage.Length)], new Vector3(0.75f, 0.75f, 0.75f));
        }
    }
コード例 #3
0
ファイル: GameManager.cs プロジェクト: filscorporation/Match
        public void StartGame()
        {
            UIManager = FindObjectOfType <GameUIManager>();

            InitializePlayers(GameSettings.PlayersCount);
            InitializePlayerStats();

            CardManager = new CardManager(this);
            FieldParams fieldParams = new FieldParams
            {
                Height = GameSettings.FieldHeight,
                Width  = GameSettings.FieldWidth,
            };

            if (GameSettings.IsOnline)
            {
                NetworkManager.Instance.ConnectIfNot();

                CardManager.InitializeField(fieldParams, GameSettings.CardPackage, GameSettings.FieldData);
                NetworkManager.Instance.ThisPlayerID = GameSettings.PlayerID;
            }
            else
            {
                fieldParams.Height -= GameSettings.Difficulty;
                fieldParams.Width  -= GameSettings.Difficulty;

                CardManager.InitializeField(fieldParams, GameSettings.CardPackage);
            }

            InputManager = new PCInputManager();
            InputManager.AddSubscriber(CardManager);

            isInGame      = true;
            isInitialized = true;
        }
コード例 #4
0
    private void OnTriggerEnter(Collider collision)
    {
        if (collision.GetComponent <Money>() != null && !holding)
        {
            holding = true;
            GameUIManager.Instance().moneyUi.Collect();
            Destroy(collision.gameObject);

            GameManager.Instance().PlaySound(moneyCollectClip);

            GameObject safe = safes[Random.Range(0, safes.Count)];
            safe.SetActive(true);
        }
        else if (collision.GetComponent <Money>() && holding)
        {
            alreadyHolding.SetActive(true);
        }
        else if (collision.GetComponent <Safe>() != null && holding)
        {
            holding = false;
            GameUIManager.Instance().moneyUi.Deliver();

            GameManager.Instance().enemySpawner.SpawnEnemy();
            GameManager.Instance().PlaySound(moneyDeliveredClip);
            GameManager.Instance().MoneyDelivered();

            Destroy(collision.gameObject);
            safes.Remove(collision.gameObject);
        }
    }
コード例 #5
0
ファイル: CameraMove.cs プロジェクト: DingLi-23/MyCat
 void Start()
 {
     m_Transform = gameObject.GetComponent<Transform>();
     cat_Transform = GameObject.FindGameObjectWithTag("cat").GetComponent<Transform>();
     normalPos = m_Transform.position;
     m_GameUIManager = GameObject.Find("UI Root").GetComponent<GameUIManager>();
 }
コード例 #6
0
    void Start()
    {
        health = GameObject.Find("PersistentDataObject").GetComponent <PersistentData>().playerHealth;
        money  = GameObject.Find("PersistentDataObject").GetComponent <PersistentData>().playerMoney;

        bulletPool = GameObject.Find("BulletPool");
        uiManager  = GameObject.Find("Canvas").GetComponent <GameUIManager>();

        // LoadAll() handles tile sets
        // moveSprites = Resources.LoadAll<Sprite>("Sprites/tyrianship/ship");
        // GetComponent<SpriteRenderer>().sprite = moveSprites[2];
        GetComponent <SpriteRenderer>().sprite = shipSprite;

        mousePos     = Vector2.zero;
        mousePosPrev = mousePos;

        // Audio source components added to player in the same order
        AudioSource[] sources = GetComponents <AudioSource>();
        mainFiringSource   = sources[0];
        chargeFiringSource = sources[1];
        secondFiringSource = sources[2];

        chargeOutlineChild = transform.Find("ChargeOutline").gameObject;
        chargeOutlineChild.GetComponent <SpriteRenderer>().enabled = false;


        if (gameObject.scene.name == "TutorialStage")
        {
            StartCoroutine(TutorialScriptedCoroutine());
        }
    }
コード例 #7
0
    void OnStartGame()
    {
        game = GameObject.Find("Game").GetComponent<Game>();
        UI = GameObject.Find("UICanvas").GetComponent<GameUIManager>();
        SetScore();
        
        SpawnBall();

        for (int i = 0; i < actors.Count; i++)
        {
            bool homeTeam = actors[i].Team == "Home";

            actors[i].OnGameReset();
            if(homeTeam)
                actors[i].SetTeamKit(Home);
            else
                actors[i].SetTeamKit(Away);

            if(actors[i].tag == "AI")
            {
                (actors[i] as AIPlayer).SetupAI(game);
            }
            else if(actors[i].tag == "Keeper")
            {
                (actors[i] as AIKeeper).SetupAI(game);
            }
        }

        state = GameState.GAME;
    }
コード例 #8
0
 private void Start()
 {
     InitLocalPlayer();
     questionManager    = GetComponent <QuestionManager>();
     gameUIManager      = GetComponent <GameUIManager>();
     localPlayerManager = PlayerManager.LocalPlayerInstance.GetComponent <PlayerManager>();
 }
コード例 #9
0
ファイル: Building.cs プロジェクト: Rylern/CitySimulator
    void OnMouseDown()
    {
        // Skip if the user has clicked on a UI element
        if (EventSystem.current.IsPointerOverGameObject())
        {
            return;
        }

        // Define gameUIManager if needed
        if (gameUIManager == null)
        {
            gameUIManager = GameObject.Find("GameUI").GetComponent <GameUIManager>();
        }

        // Destroy the building if the delete mode is activated and the building is neither the current landmark nor the Eiffel Tower
        if (gameUIManager.GetBuildingDeleteMode() && transform.position != landmarkVisibility.GetLandmarkPosition() && gameObject.name != "Eiffel Tower")
        {
            Destroy(gameObject);
        }

        // Assign the building as the new landmark
        if (gameUIManager.GetLandmarkMode())
        {
            landmarkVisibility.SetLandmark(this.gameObject);
            gameUIManager.ChangeLandmarkMode();
        }
    }
コード例 #10
0
    void Initialize()
    {
        //Create and set configurables
        //First all Monobehaviours

        if (gameUIManager == null)
        {
            gameUIManager = FindObjectOfType <GameUIManager>();
        }

        if (audioManager == null)
        {
            audioManager = FindObjectOfType <AudioManager>();
        }


        gameUIManager.SetSpawnConfig(configsReferences.GetConfig(ConfigType.TetrominoSpawn));
        audioManager.SetSpawnConfig(configsReferences.GetConfig(ConfigType.Audio));


        board                = new Board(configsReferences.GetConfig(ConfigType.Board));
        tetrominoManager     = new TetrominoManager(configsReferences.GetConfig(ConfigType.TetrominoSpawn));
        inputManager         = new InputManager(configsReferences.GetConfig(ConfigType.KeyboardInput));
        boardStateController = new BoardStateController(board, tetrominoManager, BoardStateType.InitState);
    }
コード例 #11
0
    // Use this for initialization
    void Start()
    {
        InitClientApp();

        CProtoManager dataplat = new CProtoManager();

        dataplat.LoadXMLS();


        ///-----------------------------------------------------------------
        ///数据初始化
        CScriptLuaMgr scripmgr = new CScriptLuaMgr();

        scripmgr.InitLuaMgr();

        //------------------------------------------------------------------
        // UI 系统的初始化操作
        GameUIManager PanelMgr = LuaFramework.LuaHelper.GetPanelManager();

        PanelMgr.InitFrames();


        CQuestMgr questMgr = new CQuestMgr();

        questMgr.InitQuest();

        CItemMgr itemgr = new CItemMgr();

        itemgr.InitIteMgr();

        CFightTeamMgr.Instance.Initlize();
        ///-----------------------------------------------------------------
    }
コード例 #12
0
 public void Start()
 {
     mainCamera        = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>();
     gameUIManager     = GameObject.FindObjectOfType <GameUIManager>();
     thisRectTransform = GetComponent <RectTransform>();
     thiscanvasGroup   = GetComponent <CanvasGroup>();
 }
コード例 #13
0
    void OnStartGame()
    {
        game = GameObject.Find("Game").GetComponent <Game>();
        UI   = GameObject.Find("UICanvas").GetComponent <GameUIManager>();
        SetScore();

        SpawnBall();

        for (int i = 0; i < actors.Count; i++)
        {
            bool homeTeam = actors[i].Team == "Home";

            actors[i].OnGameReset();
            if (homeTeam)
            {
                actors[i].SetTeamKit(Home);
            }
            else
            {
                actors[i].SetTeamKit(Away);
            }

            if (actors[i].tag == "AI")
            {
                (actors[i] as AIPlayer).SetupAI(game);
            }
            else if (actors[i].tag == "Keeper")
            {
                (actors[i] as AIKeeper).SetupAI(game);
            }
        }

        state = GameState.GAME;
    }
コード例 #14
0
    // Use this for initialization
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            return;
        }
        MapGenerator mapGenerator = GetComponent <MapGenerator>();
        int          gameLv1      = MainData.Instance().gameLv1;
        int          gameLv2      = MainData.Instance().gameLv2;

        mapGenerator.Generate(gameLv1, gameLv2);
        ballNum = mapGenerator.GoalNum;
        goals   = GameObject.FindGameObjectsWithTag("Goal");
        balls   = GameObject.FindGameObjectsWithTag("Ball");
        walls   = GameObject.FindGameObjectsWithTag("Wall");
        if (ClearTime == 0f)
        {
            ClearTime = 1f;
        }
        _ui = FindObjectOfType <GameUIManager>();
        AudioManager.Instance().GameStart();
    }
コード例 #15
0
        public PackageUI(GameUIManager ui, ILevelManager level, bool showResources)
        {
            this.gameUI = ui;

            using (var packageUILayout = gameUI.Game.PackageManager.GetXmlFile("Assets/UI/BaseLayout.xml", true)) {
                var style = gameUI.Game.PackageManager.GetXmlFile("Assets/UI/UIStyle.xml", true);
                PackageRoot = ui.UI.LoadLayout(packageUILayout, style);
                PackageRoot.SetDefaultStyle(style);
                gameUI.GameUIRoot.AddChild(PackageRoot);
            }



            if (gameUI.Game.Config.DebugHUD)
            {
                using (Window topBar = (Window)PackageRoot.GetChild("TopBar")) {
                    topBar.MinWidth = topBar.MinWidth - 100;
                    topBar.Width    = topBar.Width - 100;
                    topBar.MaxWidth = topBar.MinWidth;
                }
            }

            resourceDisplays = new Dictionary <ResourceType, Text>();
            var resourceDisplay = PackageRoot.GetChild("ResourceDisplay", true);

            foreach (var resourceType in level.Package.ResourceTypes)
            {
                var display = (Text)resourceDisplay.GetChild(resourceType.Name);
                resourceDisplays.Add(resourceType, display);
            }

            resourceDisplay.Visible = showResources;
        }
コード例 #16
0
 void StatusChanged()
 {
     if (status == GameStatus.Paused)
     {
         GameUIManager.Instance().GamePaused();
         InputController.Instance().GamePaused();
     }
     else if (status == GameStatus.Playing)
     {
         GameUIManager.Instance().GamePlaying();
         InputController.Instance().GamePlaying();
     }
     else if (status == GameStatus.Defeated)
     {
         //GameUIManager.Instance().GameDefeated();
         InputController.Instance().GameDefeated();
     }
     else
     {
         SetGameObject(true);
         AllChecked = false;
         GameUIManager.Instance().GameCleared();
         InputController.Instance().GameCleared();
     }
 }
コード例 #17
0
    // Use this for initialization
    void Start()
    {
        Application.targetFrameRate = 60;
        // Make self a publicly available singleton
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
        // Never destroy gameManager (on scene changes)
        DontDestroyOnLoad(gameObject);

        //levelManager = Instantiate(levelManagerPrefab, new Vector3(0f, 0f, 0f), Quaternion.identity);

        // Set managers
        gameUIManager = GetComponent <GameUIManager>();
        gameUIManager.Setup();

        // Initialize planes generator
        planesGenerator = GetComponent <UnityARGeneratePlane>();

        // Initialize level manager (the game)
        levelManager      = Instantiate(levelManagerPrefab, new Vector3(0f, 0f, 0f), Quaternion.identity);
        levelManager.name = "LevelManager";
        levelManager.transform.SetParent(transform.root);
        levelManager.GetComponent <UIManager>().SetCanvasScale(2.0f);

        // Go to calibration mode
        SetCalibrationMode();
    }
コード例 #18
0
 // Start is called before the first frame update
 void Start()
 {
     UIManager = GetComponent <GameUIManager>();
     UIManager.updateLifeText(m_player_lifes); // init player lifes
     StartCoroutine("createEnemies");          // start creating enemies
     gameIsActive = true;                      // game is active
 }
コード例 #19
0
    public void InitGame()
    {
        this.gameUI                 = GameObject.Find("GameUI").GetComponent <GameUIManager>();
        this.environment            = GameObject.Find("Environment");
        this.playerObject           = this.environment.transform.GetChild(1).GetChild(0).gameObject;
        this.enemyObject            = this.environment.transform.GetChild(1).GetChild(1).gameObject;
        this.playerStats            = playerObject.GetComponent <PlayerMechanics>();
        this.enemyStats             = enemyObject.GetComponent <EnemyMechanics>();
        this.instructionsGameObject = GameObject.Find("Tiles");
        this.instructionsGameObject.SetActive(false);
        this.arenaGameObject = environment.transform.GetChild(0).gameObject;
        this.arenaCells      = new GameObject[6, 6];
        this.arenaCellData   = new int[6, 6];

        for (int i = 0; i < this.arenaCells.GetLength(0); i++)
        {
            for (int j = 0; j < this.arenaCells.GetLength(1); j++)
            {
                this.arenaCells[i, j] = this.arenaGameObject.transform.GetChild(i).GetChild(j).gameObject;
                if (this.arenaCells[i, j].transform.childCount > 0)
                {
                    arenaCellData[i, j] = 1;
                }
                else
                {
                    arenaCellData[i, j] = 0;
                }
            }
        }

        StartCoolDownTimer(10);
    }
コード例 #20
0
ファイル: GameManager.cs プロジェクト: eb0920/Gems
    void Awake()
    {
        // 简单的赋值,暂时不考虑异常情况
        instance = this;

        mapManager = GetComponent <MapManager>();
        pathHelper = GetComponent <PathFinder>();
        m_UIMng    = GetComponent <GameUIManager>();

        // 暂时这样获取宝石的列表
        var gems = GameObject.Find("Gems");

        if (gems != null)
        {
            m_Gems = gems.GetComponentsInChildren <GemManager>();
        }

        if (m_Gems.Length > 0)
        {
            defaultGemPosition = m_Gems[0].transform.position;
        }
        else
        {
            defaultGemPosition = Vector3.zero;
        }
    }
コード例 #21
0
    public void OnEnable()
    {
        Image temp = transform.GetChild(1).GetComponent <Image>();

        if (MyKeys.Diamond_Value >= MyKeys.BuyPhysicalPowerCost)
        {
            temp.raycastTarget = true;
            temp.color         = Color.white;
        }
        else
        {
            temp.raycastTarget = false;
            temp.color         = Color.gray;
        }

        if (!SceneManager.GetActiveScene().name.Equals("UI"))
        {
            _shop_Copy = GameUIManager.ShowShop();
        }

        if (MyKeys.Physical_Power_Value >= MyKeys.Power_Replay_Max)
        {
            Image buy = transform.GetChild(1).GetComponent <Image>();
            buy.color         = Color.gray;
            buy.raycastTarget = false;
        }
    }
コード例 #22
0
    private bool inAction = false; // for detecting loading or shoting

    void Start()
    {
        manager   = GameObject.Find("GameManager").GetComponent <Manager>();
        UIManager = GameObject.Find("GameManager").GetComponent <GameUIManager>();

        setAmmoValue(numOfBulletsPerLoad); // update amount of ammo
    }
コード例 #23
0
    private void OnTriggerEnter(Collider collision)
    {
        if (collision.GetComponent <Money>() != null && !holding)
        {
            holding = true;
            GameUIManager.Instance().moneyUi.Collect();
            Destroy(collision.gameObject);

            GameManager.Instance().PlaySound(moneyCollectClip);

            GameObject safe = safes[0];
            safe.SetActive(true);

            tutorial.MoneyCollected();
        }
        else if (collision.GetComponent <Safe>() != null && holding)
        {
            holding = false;
            GameUIManager.Instance().moneyUi.Deliver();

            GameManager.Instance().PlaySound(moneyDeliveredClip);
            GameManager.Instance().MoneyDelivered();

            Destroy(collision.gameObject);
            safes.Remove(collision.gameObject);

            tutorial.MoneyDelivered();
        }
    }
コード例 #24
0
ファイル: Game1.cs プロジェクト: WuZongJin/MyGame
        protected override void Initialize()
        {
            base.Initialize();
            exitOnEscapeKeypress = false;
            NotificationManager notificationManager = new NotificationManager();
            GameUIManager       gameUIManager       = new GameUIManager();
            GameActorManager    gameActorManager    = new GameActorManager();

            gameActorManager.initPlayer();

            Core.registerGlobalManager(gameActorManager);
            Core.registerGlobalManager(gameUIManager);
            Core.registerGlobalManager(notificationManager);


            GameResources.GameTextureResource.initialize();
            Graphics.instance.bitmapFont = GameSetting.defaultGameLanguage.font;


            var startScene = new ShuChengRoom();

            var entity = gameActorManager.player.setPosition(205, 285);

            startScene.initEntity(entity);
            scene = startScene;
        }
コード例 #25
0
ファイル: GameManager.cs プロジェクト: Hamsting/AlGGaGi
    void Start()
    {
        // Temporary!!!
        myTurn = (Random.Range(0, 2) == 1) ? true : false;

        Input.multiTouchEnabled = false;

        dolls      = new List <CharacterDoll>();
        playerDoll = new List <CharacterDoll>();
        enemyDoll  = new List <CharacterDoll>();
        skills     = new List <Skill>();

        board = Board.Instance;
        board.Initialize();

        PushAllDolls();

        DollController.Instance.Initialize();

        u = GameUIManager.Instance;
        u.Initialize();
        u.ShowCharacters();

        place = PlaceMode.Instance;
        place.StartPlaceMode();

        SoundManager.Instance.PlayBGM(gameBgm);
    }
コード例 #26
0
 //Called once at the start of initialization
 public void Start()
 {
     //Initialize the gameManager to be the gameObject with the tag
     GameManager = GameObject.FindGameObjectWithTag("GameManager");
     //sets the gameuimanager to be the gameObjects script
     _gameUIManager = GameManager.GetComponent <GameUIManager>();
 }
    private void InitiatePlayer()
    {
        playerAlive = true;

        gameUIManager         = GameUIManager.currentInstance;
        gameManager.playerRef = gameObject;

        _abilityOneCooldown   = playerStats.abilityOneCooldown.GetValue();
        _abilityTwoCooldown   = playerStats.abilityTwoCooldown.GetValue();
        _abilityThreeCooldown = playerStats.abilityThreeCooldown.GetValue();

        powerupBalls = new List <GameObject>();

        if (gameManager.loadStats)
        {
            SaveManager.current.Load();

            playerStats.Init();
        }
        else if (!gameManager.loadStats)
        {
            playerStats.Init();
            //gameManager.loadStats = true;
        }
    }
コード例 #28
0
 // Start is called before the first frame update
 void Start()
 {
     uiManager           = FindObjectOfType <GameUIManager>();
     audioManager        = FindObjectOfType <GameAudioManager>();
     aSource             = GetComponent <AudioSource>();
     playerShipColliders = GetShipColliders(playerFieldData);
     otherShipColliders  = GetShipColliders(otherPlayerFeildData);
 }
コード例 #29
0
    void Start()
    {
        // GameUIManager.GetInstance().OpenUI(typeof(UILogoScreen));

        // TODO: hotfix
        // GameUIManager.GetInstance().OpenUI(typeof(UIStartUpScreen));
        GameUIManager.GetInstance().OpenUI(typeof(MainMenuScreen));
    }
コード例 #30
0
    private void Start()
    {
        m = MusicManager.instance;
        u = GameUIManager.instance;

        DebugLoad();
        StartCoroutine(StartDelay());
    }
コード例 #31
0
ファイル: GameUIManager.cs プロジェクト: liuxx220/GameApp
 public static GameUIManager Instance()
 {
     if (instance == null)
     {
         instance = new GameUIManager();
     }
     return(instance);
 }
コード例 #32
0
	// Use this for initialization
	void Awake()
	{
		if (instance == null) {
			instance = this;
		} else if (instance != this) {
			Destroy(gameObject);
		}

		Instantiate (actionMenu);
	}
コード例 #33
0
 void Awake()
 {
     thisGameUI = this;
 }
コード例 #34
0
	//public OfflineCanvasControl offlineCanvas;

	void Start()
	{
		Instance = this;
		GameManager.OnLevelComplete += OnLevelComplete;
		programButtonsCanvas.Show ();
	}
コード例 #35
0
ファイル: GameManager.cs プロジェクト: Dinendal1er/Gomoku
    // Use this for initialization
    void Start()
    {
        int x;
        int y;

        firstTurn = true;
        finish = false;
        isPaused = false;
        playTurn = false;
        try
        {
            gameUI = GameObject.FindObjectOfType<GameUIManager>();
            if (gameUI == null)
                throw new NullReferenceException("Missing the gameUI");
        }
        catch (Exception e)
        {
            ErrorUI.error = e.Message;
            LevelManager.getInstance().LoadLevel("Error");
            Destroy(GameObject.Find("UIManager"));
        }
        usedPoint = new Dictionary<Vector2, ClickPoint>();
        pWin = new List<ArrayList>();
        map = new Cases[19][];
        captured = new int[2];
        captured[0] = 0;
        captured[1] = 0;
        for (x = 0; x != 19; ++x)
        {
            map[x] = new Cases[19];
            for (y = 0; y != 19; ++y)
            {
                map[x][y] = Cases.empty;
                Instantiate(clickPointPrefab, new Vector3(x, 0.5f, y), Quaternion.identity);
            }
        }
    }