Inheritance: MonoBehaviour
Ejemplo n.º 1
0
 public static GameMgr GetInstance()
 {
     if(Instance == null)
     {
         Instance = new GameMgr();
     }
     return Instance;
 }
Ejemplo n.º 2
0
 void Start()
 {
     gameMgr = GameObject.FindWithTag("GameMgr").GetComponent<GameMgr>();
     foreach (Text t in scoresTexts){
         t.gameObject.SetActive(false);
     }
     winningPointValue = 5 + 5*(scoresTexts.Length-2);
 }
Ejemplo n.º 3
0
    void Start()
    {
        // 最初にはMuzzleFlash MeshRendererを無効にする
        _renderer.enabled = false;

        // ゲームマネージャを探す
        _gameMgr = GameObject.Find ("GameManager").GetComponent<GameMgr> ();
    }
Ejemplo n.º 4
0
    void Start()
    {
        //最初にはMuzzleFlashコンポーネントの設定パラメータ
        _renderer.enabled = false;

        //ゲームマネージャーを探す
        _gameMgr = GameObject.Find("GameManager").GetComponent<GameMgr>();
    }
Ejemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        _gameMgr = GameObject.Find ("GameManager").GetComponent<GameMgr> ();
        w = 800;
        h = 480;
        _playerCtrl = GameObject.FindWithTag ("PLAYER").GetComponent<playerCtrl> ();

        wObj = 250;
        hObj = 250;
        speedHeight=250.0f;
    }
Ejemplo n.º 6
0
    void Awake()
    {
        if(instance == null){
            instance = this;
        }else if(instance != this){
           Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);

         bdmgrScript = GetComponent<BoardMgr>();
    }
Ejemplo n.º 7
0
    // Use this for initialization
    void Start()
    {
        _gameMgr = GameObject.Find ("GameManager").GetComponent<GameMgr> ();
        _animation = GetComponentInChildren<Animation> ();
        _animation.clip = anim.idle;
        _animation.Play ();
        _playerCtrl = GetComponent<playerCtrl> ();
        WaterFall1 = GameObject.Find ("/player/WaterFall1");
        WaterFall2 = GameObject.Find ("/player/WaterFall2");

        //StartCoroutine(this.PlaySfx(musicback,0.9f));
    }
Ejemplo n.º 8
0
 void Awake()
 {
     pv = GetComponent<PhotonView>();
     mar = GameObject.Find("GameManager").GetComponent<GameMgr>();
     tankPosition = GameObject.Find("GameManager").GetComponent<TankPosition>();
     killDeathLoMsg = GameObject.Find("KillDeathLoMsg ").GetComponent<Text>();
     scrollContents = GameObject.Find("KDLoMsgScroll").GetComponent<RectTransform>();
     roomKill = (int)PhotonNetwork.room.customProperties["aimKill"];
     rotator = GameObject.Find("SkyCamera").GetComponent<RotateSkyBox>();
     textHp = GameObject.Find("HP").GetComponent<Text>();
     nowtankHp = tankHp; //현재 생명력을 초기 생명력으로 초기화
     textHp.text = nowtankHp.ToString();
     textHp.color = Color.green;
 }
Ejemplo n.º 9
0
    void Awake()
    {
        m_Ins = this;

        UnitCache unitCache = null;

        unitCache = new UnitCache ("TestUnit");
        m_unitNameList.Add (unitCache);
        unitCache.m_cacheId = m_unitNameList.Count - 1;

        unitCache = new UnitCache ("TestUnit");
        m_unitNameList.Add (unitCache);
        unitCache.m_cacheId = m_unitNameList.Count - 1;
    }
Ejemplo n.º 10
0
 private void BnetParty_OnPartyAttributeChanged_Error(PartyInfo party, string attributeKey, bnet.protocol.attribute.Variant value)
 {
     if (party.Type == PartyType.FRIENDLY_CHALLENGE)
     {
         if (this.DidReceiveChallenge() && value.HasIntValue)
         {
             object[] args = new object[] { value.IntValue };
             Log.Party.Print(LogLevel.Error, "BnetParty_OnPartyAttributeChanged_Error - code={0}", args);
             BnetErrorInfo info = new BnetErrorInfo(BnetFeature.Games, BnetFeatureEvent.Games_OnCreated, (BattleNetErrors)((uint)value.IntValue));
             GameMgr.Get().OnBnetError(info, null);
         }
         if (BnetParty.IsLeader(party.Id) && !value.IsNone())
         {
             BnetParty.ClearPartyAttribute(party.Id, attributeKey);
         }
     }
 }
Ejemplo n.º 11
0
        static int __CreateInstance(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                if (LuaAPI.lua_gettop(L) == 1)
                {
                    GameMgr gen_ret = new GameMgr();
                    translator.Push(L, gen_ret);

                    return(1);
                }
            }
            catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to GameMgr constructor!"));
        }
Ejemplo n.º 12
0
        static int _m_share_club_xlua_st_(RealStatePtr L)
        {
            try {
                {
                    int  _club_id = LuaAPI.xlua_tointeger(L, 1);
                    bool _tl      = LuaAPI.lua_toboolean(L, 2);

                    GameMgr.share_club(_club_id, _tl);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Ejemplo n.º 13
0
        static int _m_myself_xlua_st_(RealStatePtr L)
        {
            try {
                {
                    int _uid = LuaAPI.xlua_tointeger(L, 1);

                    bool gen_ret = GameMgr.myself(_uid);
                    LuaAPI.lua_pushboolean(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Ejemplo n.º 14
0
    private void GameMgrInit()
    {
        this.RegisterUIView();
        instance = this;
        var audioSystem = GameObject.Find("AudioSystem").gameObject;

        DontDestroyOnLoad(this);
        DontDestroyOnLoad(Camera.main);
        DontDestroyOnLoad(UIManager.Instance.UiRoot);
        DontDestroyOnLoad(audioSystem);
        DontDestroyOnLoad(GetComponent <Camera>());
        this.msgHandleDic = new Dictionary <MsgNoS2C, List <MsgHandlerFun> >();
        ApplicationFacade.Instance.RegisterMediator(new GameMgrMediator(Mediators.GAMEMGR_MEDIATOR, this));
        ResourcesMgr resMgr = ResourcesMgr.Instance;

        this.InitPrefsKey();
    }
Ejemplo n.º 15
0
    /*
     * Collider가 어떤 물체에 닿으면 호출되는 함수
     *
     * 자신의 GameObject에 Collider(IsTrigger를 ON으로 하여)와 Rigidbody를
     * 적용하면 호출 가능한 상태가 된다
     */
    private void    OnTriggerEnter(Collider hitCollider)
    {
        if (hitCollider.GetComponent <Goal>() != null)
        {
            GameMgr.Heal();
        }

        // 히트(닿았을 때) 효과가 있는지 검사
        if (null != hitEffectPrefab)
        {
            // 자신의 위치에서 히트 효과를 연출
            Instantiate(hitEffectPrefab, transform.position, transform.rotation);
        }

        // 이 GameObject를 Hierarchy에서 삭제
        Destroy(gameObject);
    }
Ejemplo n.º 16
0
    public void Win()
    {
        if (player.dead)
        {
            return;
        }
        player.Win();
        levelState         = LevelState.Won;
        UIInformation.text = "You did it!";
        UIScoreScreen.SetActive(true);
        UITotalScore.text = (score + (int)time).ToString();
        //Calculate score (time + score)
        countdown = 5;
        GameMgr.AddScore(score, time);

        HUDInGameObject.SetActive(false);
    }
Ejemplo n.º 17
0
    // Use this for initialization
    void Start()
    {
        gameMgr       = GameObject.Find("GameMgr");
        gameMgrScript = gameMgr.GetComponent <GameMgr> ();
        player        = GameObject.FindGameObjectWithTag("PLAYER");

        _color [0] = Color.black;
        _color [1] = Color.blue;
        _color [2] = Color.cyan;
        _color [3] = Color.gray;
        _color [4] = Color.green;
        _color [5] = Color.red;
        _color [6] = Color.magenta;
        _color [7] = Color.white;
        _color [8] = Color.yellow;
        GetComponent <Renderer>().material.color = _color[Random.Range(0, 8)];
    }
Ejemplo n.º 18
0
 public void DisconnectFromGameplay()
 {
     SceneMgr.Mode postDisconnectSceneMode = GameMgr.Get().GetPostDisconnectSceneMode();
     GameMgr.Get().PreparePostGameSceneMode(postDisconnectSceneMode);
     if (postDisconnectSceneMode == SceneMgr.Mode.INVALID)
     {
         Network.Get().ShowBreakingNewsOrError("GLOBAL_ERROR_NETWORK_LOST_GAME_CONNECTION", 0f);
     }
     else if (Network.WasDisconnectRequested())
     {
         SceneMgr.Get().SetNextMode(postDisconnectSceneMode);
     }
     else
     {
         this.ShowGameplayDialog(postDisconnectSceneMode);
     }
 }
Ejemplo n.º 19
0
    void InitEventHandler()
    {
        GameMgr gm = GameMgr.GetInstance();

        gm.AddHandler("recommend_room_updated", data => {
            if (!shown)
            {
                return;
            }

            refresh();
        });

        gm.AddHandler("sys_message_updated", data => {
            updateMessageCnt();
        });
    }
Ejemplo n.º 20
0
 private bool OnFindGameEvent(FindGameEventData eventData, object userData)
 {
     this.UpdateMyAvailability();
     if (eventData.m_state == FindGameState.BNET_ERROR)
     {
         if (this.DidSendChallenge())
         {
             BnetParty.SetPartyAttributeLong(this.m_partyId, "error", (long)GameMgr.Get().GetLastEnterGameError());
             BnetParty.SetPartyAttributeString(this.m_partyId, "s1", "deck");
         }
         else if (this.DidReceiveChallenge())
         {
             BnetParty.SetPartyAttributeString(this.m_partyId, "s2", "deck");
         }
     }
     return(false);
 }
Ejemplo n.º 21
0
 protected override void Awake()
 {
     base.Awake();
     this.m_gamesWonIndicator.Hide();
     this.m_noGoldRewardText.gameObject.SetActive(false);
     if (base.ShouldMakeUtilRequests())
     {
         if (GameMgr.Get().IsTutorial() && !GameMgr.Get().IsSpectator())
         {
             NetCache.Get().RegisterTutorialEndGameScreen(new NetCache.NetCacheCallback(this.OnNetCacheReady));
         }
         else
         {
             NetCache.Get().RegisterScreenEndOfGame(new NetCache.NetCacheCallback(this.OnNetCacheReady));
         }
     }
 }
Ejemplo n.º 22
0
        public async Task <JsonResult> AddGameChat(string id, string contents)
        {
            string   username = User.Identity.Name;
            GaiaGame gaiaGame = GameMgr.GetGameByName(id);

            //判断玩家是否存在
            if (!gaiaGame.UserGameModels.Exists(item => item.username == username))
            {
                return(new JsonResult(new GaiaProject.Models.Data.UserFriendController.JsonData
                {
                    data = "",
                    info = new GaiaProject.Models.Data.UserFriendController.Info
                    {
                        state = 200,
                        message = "不能在其他玩家的游戏中发表留言."
                    }
                }));
            }

            Faction faction = gaiaGame.FactionList.Find(item => item.UserName == username);

            GameChatModel gameChatModel = new GameChatModel();

            gameChatModel.addtime       = DateTime.Now;
            gameChatModel.username      = username;
            gameChatModel.contents      = contents;
            gameChatModel.gameinfo_name = id;
            gameChatModel.factionname   = faction.FactionName.ToString();
            //gameChatModel.gameinfo_name
            //添加到游戏内容中
            if (gaiaGame.ListChatModels == null)
            {
                gaiaGame.ListChatModels = new List <GameChatModel>();
            }
            gaiaGame.ListChatModels.Add(gameChatModel);


            return(new JsonResult(new GaiaProject.Models.Data.UserFriendController.JsonData
            {
                data = "",
                info = new GaiaProject.Models.Data.UserFriendController.Info
                {
                    state = 200
                }
            }));
        }
Ejemplo n.º 23
0
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Ball")
     {
         ball = other.gameObject;
         ball.transform.position = transHoldBall.position;
         ball.transform.SetParent(this.transform);
     }
     else if (other.tag == "Gate")
     {
         GameMgr.GetInstance().CheckPhaseWinInGate(ball != null);
     }
     else if (other.tag == "TheWall")
     {
         DissolveObstacle();
     }
 }
Ejemplo n.º 24
0
	// Use this for initialization
	void Awake(){
	
		
		if(self)
		{
			Destroy(this);
			Destroy(this.gameObject);
			return;
		}
		
		self = this;
		
		DontDestroyOnLoad(this.gameObject);
		Application.targetFrameRate = 30;
		UpdateResolution();
		
	}
Ejemplo n.º 25
0
    protected override void Initialize()
    {
        MyGoblin = this;
        GM       = GameMgr.GM;

        // CurHP = HP;

        MyRidbody = this.GetComponent <Rigidbody2D>();

        MyRidbody.drag = friction;
        Anim           = this.transform.Find("Model").Find("model").GetComponent <Animator>();
        ModelChildObj  = this.transform.Find("Model").GetComponentsInChildren <Transform>();


        ConstructFSM();
        MentInit("anotherorc");
    }
Ejemplo n.º 26
0
    protected void OnReturnPressed()
    {
        SceneMgr sceneMgr = GameMgr.GetInstance().GetServer <SceneMgr>();

        //muestro el menu..
        //TODO 2 if type == TPushSceneType.PUSH_SCENE => PushScene else ReturnScene
        if (m_type == TPushSceneType.PUSH_SCENE)
        {
            //Debug.LogError("apilamos la escena de menu ");
            sceneMgr.PushScene(m_menuSceneName);
        }
        else
        {
            //Debug.LogError("Desapilamos la escena en la cima de la pila");
            sceneMgr.PopScene(m_clearReturnScene);
        }
    }
Ejemplo n.º 27
0
    void Entry(string host, int port)
    {
        mHost = host;
        mPort = port;

        pc.NetWorkStateChangedEvent += OnStateChanged;

        //pc.initClient (host, port, result => {
        pc.initClient(mServer, port, result => {
            if (!result)
            {
                Debug.Log("Entry initClient fail");
                return;
            }

            pc.connect(null, data => {
                JsonObject obj = new JsonObject();

                obj.Add("token", mToken);

                pc.request("connector.entryHandler.entry", obj, ret => {
                    if (ret == null || !ret.ContainsKey("code"))
                    {
                        pc.disconnect();
                        return;
                    }

                    int code = Convert.ToInt32(ret ["code"]);
                    if (code != 0)
                    {
                        Debug.Log("entry disconnect");
                        pc.disconnect();
                        return;
                    }

                    // TODO
                    Debug.Log("login done");

                    mConnected = true;

                    GameMgr gm = GameMgr.GetInstance();
                    gm.onLogin(ret);
                });
            });
        });
    }
Ejemplo n.º 28
0
        private bool OnTaskPlayTournament(TaskParamPlayTournament p)
        {
            PegasusShared.GameType type = p.Ranked ?
                                          PegasusShared.GameType.GT_RANKED :
                                          PegasusShared.GameType.GT_UNRANKED;

            long deckID = GetDeckID(p.DeckIndex);

            if (deckID == 0)
            {
                HSMPClient.Get().SendDebugMessage("invalid deck ID :(");
                return(false);
            }

            GameMgr.Get().FindGame(type, 2, deckID, 0);
            return(true);
        }
Ejemplo n.º 29
0
    void reconnect(Action <bool> cb)
    {
        Debug.Log("reconnect");

        //pc.initClient (mHost, mPort, result => {
        pc.initClient(mServer, mPort, result => {
            if (!result)
            {
                Debug.Log("reconnect initClient fail");
                cb(false);
                return;
            }

            pc.connect(null, data => {
                JsonObject obj = new JsonObject();

                obj.Add("token", mToken);

                pc.request("connector.entryHandler.entry", obj, ret => {
                    if (ret == null || !ret.ContainsKey("code"))
                    {
                        cb(false);
                        return;
                    }

                    int code = Convert.ToInt32(ret ["code"]);

                    Debug.Log("entry return:" + code);

                    if (code != 0)
                    {
                        cb(false);
                        return;
                    }

                    Debug.Log("reconnect done");

                    mConnected = true;

                    GameMgr gm = GameMgr.GetInstance();
                    gm.onResume(ret);
                    cb(true);
                });
            });
        });
    }
Ejemplo n.º 30
0
        public void OnEnable()
        {
            var ownCards = GameMgr.GetIns().GetDataMgrIns().GetUserOwnCardData();

            foreach (var id in summonCards)
            {
                if (ownCards.ContainsKey(id))
                {
                    ownCards[id]++;
                }
                else
                {
                    ownCards.Add(id, 1);
                }
            }
            Sender.Send("AddSummonCard");
        }
Ejemplo n.º 31
0
    // Use this for initialization
    void Start()
    {
        // 设置生命初始值
        initHp = hp;
        // 向脚本初始部分分配Transform组件
        tr = GetComponent <Transform>();

        // 获取GameMgr脚本
        gameMgr = GameObject.Find("GameManager").GetComponent <GameMgr>();

        // 查找谓语自身下级的Animation组件并分配到变量
        _animation = GetComponentInChildren <Animation>();

        // 保存并运行Animation组件的动画片段
        _animation.clip = anim.idle;
        _animation.Play();
    }
Ejemplo n.º 32
0
    public override void OnInspectorGUI()
    {
        GameMgr mgr = (GameMgr)target;

        SerializedObject serializedBrain = serializedObject;

        SerializedProperty bt = serializedBrain.FindProperty("mainBird");

        EditorGUILayout.PropertyField(bt);
        bt = serializedBrain.FindProperty("pillar");
        EditorGUILayout.PropertyField(bt);
        bt = serializedBrain.FindProperty("mode");
        EditorGUILayout.PropertyField(bt);
        mgr.FillEnv();
        mgr.Env.OnInspector();
        serializedBrain.ApplyModifiedProperties();
    }
Ejemplo n.º 33
0
    void Awake()
    {
        if (_instance == null)
        {
            _instance = this;
        }
        else if (_instance != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);

        SceneManager.sceneLoaded += OnSceneLoaded; // 在委托中添加方法 OnSceneLoaded()

        InitGame();
    }
Ejemplo n.º 34
0
        /// <summary>
        /// 修改游戏
        /// </summary>
        /// <param name="id"></param>
        /// <param name="row"></param>
        /// <param name="code"></param>
        /// <returns></returns>
        public IActionResult ModifyGameSyntax(string id, int row, string code)
        {
            GaiaGame gaiaGame = GameMgr.GetGameByName(id);

            List <LogEntity> logList = gaiaGame.LogEntityList.OrderBy(x => x.Row).ToList();
            //string[] syntaxList = gaiaGame.UserActionLog.Split("\r\n");
            LogEntity logEntity = logList[row - 1];

            logEntity.Syntax = code;
            StringBuilder stringBuilder = new StringBuilder();

            logList.ForEach(item => stringBuilder.Append($"{item.Syntax}\r\n"));
            gaiaGame.UserActionLog = stringBuilder.ToString();
            //重置游戏
            GameMgr.RestoreGame(gaiaGame.GameName, gaiaGame, isToDict: true);
            return(View("ViewGame", gaiaGame));
        }
Ejemplo n.º 35
0
    /// <summary>
    /// El método es llamado por el sistema de eventos de la UI y se le pasa por parámetro la escena que quiere cargar. Adicionalmente peude tener establecida como variable pública
    /// en el inspector una siguiente escena a cargar, en caso de que la escena de carga sea una pantalla de carga.
    /// </summary>
    /// <param name="sceneToGo"></param>
    public void OnChangeScene(string sceneToGo)
    {
        //TODO 1 cambiamos de escena o hacemos desapilamos la escena en función de los que indique el inspector.
        SceneMgr sceneMgr = GameMgr.GetInstance().GetServer <SceneMgr>();

        if (m_return)
        {
            Debug.Log("Desapilando la escena en la cima de la pila");
            sceneMgr.PopScene(true);
        }

        else
        {
            Debug.Log("Cambiando de escena a " + sceneToGo);
            sceneMgr.ChangeScene(sceneToGo, m_nextSceneAfterTransitionScene);
        }
    }
 public void Unload()
 {
     CollectionManager.Get().RemoveDeckCreatedListener(new CollectionManager.DelOnDeckCreated(this.OnDeckCreated));
     CollectionManager.Get().RemoveDeckDeletedListener(new CollectionManager.DelOnDeckDeleted(this.OnDeckDeleted));
     CollectionManager.Get().RemoveDeckContentsListener(new CollectionManager.DelOnDeckContents(this.OnDeckContents));
     FriendChallengeMgr.Get().RemoveChangedListener(new FriendChallengeMgr.ChangedCallback(this.OnFriendChallengeChanged));
     NetCache.Get().RemoveUpdatedListener(typeof(NetCache.NetCacheTavernBrawlRecord), new System.Action(this.NetCache_OnTavernBrawlRecord));
     GameMgr.Get().UnregisterFindGameEvent(new GameMgr.FindGameCallback(this.OnFindGameEvent));
     if ((FriendChallengeMgr.Get().IsChallengeTavernBrawl() && !SceneMgr.Get().IsInGame()) && !SceneMgr.Get().IsModeRequested(SceneMgr.Mode.FRIENDLY))
     {
         FriendChallengeMgr.Get().CancelChallenge();
     }
     if (this.IsInDeckEditMode())
     {
         Navigation.Pop();
     }
 }
Ejemplo n.º 37
0
    public void onBuyIAPResp(string receipt)
    {
        var file = Application.persistentDataPath + "/receipts/" + receipt;

        buying = false;

        if (!File.Exists(file))
        {
            Debug.Log("receipt not exist");
            return;
        }

        string content = File.ReadAllText(file);
        var    args    = new JsonObject();
        var    token   = NetMgr.GetInstance().getToken();

        args ["token"]  = token;
        args["receipt"] = content;

        var http = Http.GetInstance();

        http.Post("/pay_iap/query_order", args, data => {
            Debug.Log("ret from pay_iap");

            QueryOrderReply ret = JsonUtility.FromJson <QueryOrderReply> (data.ToString());

            if (ret.errcode == (int)QueryOrderErrcode.ORDER_SUCCESS)
            {
                GameAlert.Show("购买成功");

                GameMgr.GetInstance().get_coins();

                File.Delete(file);
            }
            else
            {
                GameAlert.Show("购买失败:" + ret.errcode);
            }

            WaitMgr.Hide();
        }, err => {
            WaitMgr.Hide();
            GameAlert.Show("购买通讯失败");
        });
    }
Ejemplo n.º 38
0
 // Update is called once per frame
 protected void Update()
 {
     m_timeToLastEnemyGenerate -= Time.deltaTime;
     //Cuando termina el tiempo entre generacion y generacion, creamos un objeto dle pool.
     if (m_timeToLastEnemyGenerate < 0 && _prefabs.Length > 0 && m_numEnemies < m_numMaxEnemies)
     {
         m_numEnemies++;
         m_timeToLastEnemyGenerate = m_timeToGenerateS;
         int     enemyIdx = Random.Range(0, _prefabs.Length);
         Vector3 position = transform.position;
         float   radious  = Random.Range(0.0f, _generateRadious);
         position += m_offset * radious;
         //Par instanciarlo usamos el SpawnerMgr. Si lo usamos podremos utilizar el pool de objetos precargados
         //lo que nos ayudara a reducir la fragmentacio nde memoria.
         ///TODO 1 instanciar usando el spawnerMGr.
         GameMgr.GetInstance().GetSpawnerMgr().CreateNewGameObject(_prefabs[enemyIdx], position, transform.rotation);
     }
 }
Ejemplo n.º 39
0
 protected void Start()
 {
     m_inputMgr = GameMgr.GetInstance().GetServer <InputMgr>();
     Debug.Assert(m_inputMgr != null, "Error, no se ha cargado el inputMgr");
     //TODO 1 registrarnos en RegisterPointAndClickEvent con (OnBeginClick, null, OnBeginClick);
     m_inputMgr.RegisterPointAndClickEvent(OnBeginClick, null, OnBeginClick);
     m_speed               = m_initialSpeed;
     m_rightInstantAngle   = m_angleToInstantRotate;
     m_leftInstantAngle    = 365 - m_angleToInstantRotate;
     m_targetPoint         = transform.position;
     m_characterController = GetComponent <CharacterController>();
     Debug.Assert(m_characterController != null, "Error, debe existir un character controller para poder utilizar FpsController");
     m_state = TState.STOP;
     m_animationComponent = GetComponent <PlayerAnimation>();
     Debug.Assert(m_animationComponent != null, "Error, el componente PlayerAnimation debe estar asignado en el GameObject");
     m_attackComponent = GetComponent <AttackComponent>();
     Debug.Assert(m_attackComponent != null, "Error, el componente AttackComponent debe estar asignado en el GameObject");
 }
Ejemplo n.º 40
0
        private void HandlePlayerUsingProp(GSPacketIn pkg)
        {
            BaseGame game = GameMgr.FindGame(pkg.ClientID);

            if (game != null)
            {
                game.Resume();
                if (pkg.ReadBoolean())
                {
                    Player           player   = game.FindPlayer(pkg.Parameter1);
                    ItemTemplateInfo template = ItemMgr.FindItemTemplate(pkg.Parameter2);
                    if (player != null && template != null)
                    {
                        player.UseItem(template);
                    }
                }
            }
        }
Ejemplo n.º 41
0
    // Use this for initialization
    void Start()
    {
        //screen
        //Screen.SetResolution(600, 1024 , true);

        h = 0.0f;
        v = 0.0f;
        vspeed = 20.0f;
        hSpeed = 40.0f;
        tr = GetComponent<Transform> ();
        isDead = false;
        basicAngle = -0.5f;
        sensiAngle = 0.3f;
        playerState.state = playerState.idle;
        maxVspeed = 40.0f;
        minVspeed = 20.0f;
        _gameMgr = GameObject.Find ("GameManager").GetComponent<GameMgr> ();
    }
Ejemplo n.º 42
0
 public static GameMgr GetInstance()
 {
     if (instance == null)
         instance = new GameMgr();
     return instance;
 }
Ejemplo n.º 43
0
        private void Reset(GameMgr mgr = null)
        {
            if (mgr == null)
            {
                var mode = (m_Mgr?.Mode ?? SolvingMode.ZeroProb) & SolvingMode.ZeroProb;
                m_Mgr = new GameMgr(m_Width, m_Height, m_Mines) { Mode = mode };
            }
            else
                m_Mgr = mgr;

            foreach (var ub in m_UIBlocks)
                ub.TheMgr = m_Mgr;

            ClientSize = new Size(
                (int)(m_Width * 25 * m_ScaleFactor),
                (int)(m_Height * 25 * m_ScaleFactor) + progressBar1.Height);

            m_Mgr.StatusUpdated += () => InvokeIfRequired(this, UpdateAll);
            m_Mgr.FetchStatus();

            m_Mgr.Solve();
            UpdateText();
        }
Ejemplo n.º 44
0
 // Use this for initialization
 void Start()
 {
     gameMgr = GameObject.FindWithTag("GameMgr").GetComponent<GameMgr>();
     curTimer = secondsUntilEnd;
 }
Ejemplo n.º 45
0
 void Awake()
 {
     instance = this;
 }
Ejemplo n.º 46
0
 // Use this for initialization
 void Start()
 {
     _gameMgr = GameObject.Find ("GameManager").GetComponent<GameMgr> ();
 }
Ejemplo n.º 47
0
    void Start()
    {
        //
        _slider = GameObject.Find("Slider").GetComponent<Slider>();
        Cursor.visible = false;

        //スクリプトの初めにTransformコンポネントを割り当てる
        tr = GetComponent<Transform>();

        //GameMgrスクリプトを割り当てる
        _gameMgr = GameObject.Find ("GameManager").GetComponent<GameMgr>();

        //Animationコンポーネントのclipプロパティにidle Animation Clipを指定
        aniBody.clip = anim.idle;
        //指定されたAnimation Clipを実行
        aniBody.Play();
    }
Ejemplo n.º 48
0
 void Awake()
 {
     Instance = this;
 }
Ejemplo n.º 49
0
	void OnEnable () {
		if (_instance == null) {
			_instance = this;
			DontDestroyOnLoad(_instance);
		}
	}
Ejemplo n.º 50
0
    // Use this for initialization
    void Start()
    {
        //スクリプトの初めにTransformコンポーネントを割り当てる
        tr = GetComponent<Transform>();
        //自分の下位にあるAnimationコンポーネントを探して変数に代入する
        _animation = GetComponentInChildren<Animation>();

        //GameMgrスクリプトを割り当てる
        _gameMgr = GameObject.Find("GameManager").GetComponent<GameMgr>();

        //Animationコンポーネントのアニメーションクリップを指定して実行
        _animation.clip = anim.idle;
        _animation.Play();
    }
Ejemplo n.º 51
0
    void Start()
    {
        //PhotonNetwork sends 30 times in a second.
        PhotonNetwork.sendRate = 30;
        PhotonNetwork.sendRateOnSerialize = 30;
        pv = GetComponent<PhotonView> ();

        //All player must renew all object's texture.
        pv.RPC ("SetTextureOfPlayer", PhotonTargets.All, null);

        androidPluginManager = GetComponent<AndroidPluginManager> ();
        _rigidbody = GetComponent<Rigidbody> ();
        _transform = GetComponent<Transform> ();

        if (pv.isMine == true) {

        } else {
            _rigidbody.isKinematic=true;
        }

        isServer = (bool)PhotonNetwork.player.customProperties ["ISSERVER"];
        GetComponent<Rigidbody> ().constraints = RigidbodyConstraints.FreezePositionZ;
        gameMgr = GameObject.Find ("GameManager").GetComponent<GameMgr> ();
        ownerID = gameObject.GetComponent<PhotonView> ().owner.ID;
    }
Ejemplo n.º 52
0
 // Use this for initialization
 void Start()
 {
     startPoint = GameObject.Find ("playerSpawnPoint/startPoint").GetComponent<Transform> ();
     playerTr = GetComponent<Transform> ();
     _gameMgr = GameObject.Find ("GameManager").GetComponent<GameMgr> ();
 }
Ejemplo n.º 53
0
    void Awake()
    {
        m_Ins = this;

        UnitCache unitCache = null;

        unitCache 			= new UnitCache ("U_00");
        m_unitNameList.Add (unitCache);
        unitCache.m_cacheId = m_unitNameList.Count - 1;

        unitCache 			= new UnitCache ("U_00");
        m_unitNameList.Add (unitCache);
        unitCache.m_cacheId = m_unitNameList.Count - 1;
        
        unitCache 			= new UnitCache ("commandCenter");
        m_unitNameList.Add (unitCache);
        unitCache.m_cacheId = m_unitNameList.Count - 1;

        m_produceEnerge.Init ();
    }