Beispiel #1
0
    protected void Awake()
    {
        gm = FindObjectOfType <GameManager>();

        if (gm == null)
        {
            Debug.LogError($"{name}: cannot find game manager!");
        }

        waveText = FindObjectOfType <WaveText>();

        if (waveText == null)
        {
            Debug.LogError($"{name}: cannot find wave text!");
        }

        waveCounter = FindObjectOfType <WaveCounter>();

        if (waveCounter == null)
        {
            Debug.LogError($"{name}: cannot find wave counter!");
        }

        if (LevelMap == null)
        {
            Debug.LogError($"{name}: No level map assigned!");
        }

        // Register listeners
        GameStartEvent.RegisterListener(StartAssault);
    }
Beispiel #2
0
 private void LogEvent(GameStartEvent e)
 {
     if (e.LoggingLevel <= LoggingLevel)
     {
         Debug.Log(e.Description);
     }
 }
Beispiel #3
0
 void Handle(GameStartEvent e)
 {
     constraint.ForEachGameObject((egoComponent, animation, player, spriteRenderer, collider, rb) => {
         collider.enabled = true;
         rb.IsAwake();
     });
 }
Beispiel #4
0
        /// <summary>
        // ゲーム開始イベントハンドリング
        /// </summary>
        public override void GameStartEventHandler(GameStartEvent data)
        {
            base.GameStartEventHandler(data);
            // Process the commands information.  Also, you can publish new events by using the line below.
            // this.Publish(new AnotherEvent())

            // ゲームロジッククラスの初期化
            _cubeClicker.Init();
            // スコアとタイムリミットの更新
            UpdateHUD();
            // キューブを生成させる
            SpawnCube();

            // UpdateAsObservableは毎フレーム処理させることができる
            // TimeLimitの更新処理
            this.UpdateAsObservable().Subscribe(_ => {
                UpdateTimeLimit(Time.deltaTime);
            }).DisposeWith(GameHUD);

            // Observable.Intervalは指定時間の間隔で処理を実行させられる
            // 指定時間の間隔でキューブ生成処理を実行する
            Observable.Interval(TimeSpan.FromSeconds(1.0)).Subscribe(_ => {
                SpawnCube();
            }).DisposeWith(CubeSpawn);
        }
Beispiel #5
0
    //localstring加载回调
    private static void AssetLoadCallBack(Object target, string path)
    {
        if (null == target)
        {
            return;
        }
        TextAsset txt = target as TextAsset;

        string[] lines = txt.text.Split("\n"[0]);
        for (int i = 0; i < lines.Length; i++)
        {
            string strLine = lines[i];
            if (strLine != "")
            {
                string[] keyValue = strLine.Split(':');
                if (keyValue.Length >= 2)
                {
                    localWord[keyValue[0]] = keyValue[1].Replace("\\n", "\n").Replace("\\t", "\t");
                }
                else
                {
                    localWord[keyValue[0]] = "";
                }
            }
        }

        GameStartEvent.getInstance().dispatchEvent(GameLoadStepEvent.LOAD_WORD);
    }
Beispiel #6
0
 public void Dispatch(GameStartEvent gameEvent)
 {
     foreach (EventManager.EntityListener entityListener in _entityListeners.ToArray())
     {
         entityListener.Listener.OnGameStart(gameEvent);
     }
 }
        private void OnGameStart(GameStartEvent gameStart)
        {
            var team = _thiefTeamFactory.Create();

            team.Subscribe(this);
            team.Go();
        }
Beispiel #8
0
 //TODO: Later create a game rules info config
 private void OnGameStarted(GameStartEvent e)
 {
     timerText.gameObject.SetActive(true);
     timerStarted = true;
     SetText(100);
     startTime = DateTime.Now;
 }
Beispiel #9
0
        public static void Main(string[] args)
        {
            string       whatarewe = Assembly.GetEntryAssembly().Location; //get the location of the .exe
            string       dir       = Path.GetDirectoryName(whatarewe);     //get the directory it's in
            PluginLoader loader    = new PluginLoader($"{dir}/Plugins");   //the Plugins folder will be in our directory -> Plugins. It will be created on first run if it doesnt exist

            Events.SetMaster();                                            //Make it so that only this application can lock or unlock events
            XanaAwakenEvent.Lock();                                        //locking an event
            //note: since this application is different from LyokoForDummies_Extending for example, it will not be able to call this event either, which is not what we want in this case.
            //You'll probably want to use Events.LockAll() in most cases though

            Console.WriteLine("Welcome to fake Lyoko, press enter to start a Game");
            Console.ReadKey();
            Console.WriteLine("Testing Extending");

            GameStartEvent.Call(); //game isn't in story mode, so we dont need to provide a boolean
            ExtendingTest.Test();
            GameEndEvent.Call(false);

            Console.WriteLine("Tested. Press enter to test Reconstructing");
            GameStartEvent.Call(); //game isn't in story mode, so we dont need to provide a boolean
            GameEndEvent.Call(false);
            ReconstructingTest.Test();

            Console.WriteLine("Tested, press enter to quit");
            Console.ReadKey();
        }
Beispiel #10
0
 protected void OnDestroy()
 {
     GameOverEvent.UnregisterListener(GameOver);
     GameWonEvent.UnregisterListener(GameWon);
     GameStartEvent.UnregisterListener(GameStart);
     MenuEvent.UnregisterListener(Menu);
 }
 void onGameStart(GameStartEvent gameStartEvent)
 {
     allStatsData.TotalCheckpoints  = gameStartEvent.AmountOfCheckpoints;
     allStatsData.TotalCollectables = gameStartEvent.AmountOfCollectables;
     allStatsData.TotalEnemies      = gameStartEvent.AmountOfEnemies;
     allStatsData.TotalPowerups     = gameStartEvent.AmountOfPowerups;
     print("REGISTERED STATS ON GAME START");
 }
Beispiel #12
0
 //Single
 public static GameStartEvent getInstance()
 {
     if (_instance == null)
     {
         _instance = new GameStartEvent();
         return(_instance);
     }
     return(_instance);
 }
Beispiel #13
0
 void Awake()
 {
     DontDestroyOnLoad(transform.gameObject);
     _quackInterval = new System.Random();
     _menuOpening   = new MenuOpeningEvent(menuMusic);
     _menuClosing   = new MenuClosingEvent(menuMusic);
     _gameResuming  = new GameStartEvent(gameMusic, quack, this);
     _gamePausing   = new GamePausingEvent(gameMusic);
 }
    void Start()
    {
        GameStartEvent.Register(onGameStart);
        CheckpointReachedEvent.Register(onCheckpointReached);
        statistics = GameObject.FindGameObjectWithTag("Statistics").GetComponent <Statistics>();

        slider = GetComponentInChildren <CircleSlider>();
        text   = GetComponentInChildren <Text>();
    }
Beispiel #15
0
    public void GameStart()
    {
        GameManager.GameInit = true;
        GameStartEvent.GetInstance().dispatchEvent(GAME_LOAD_SETP_EVENT.LOAD_COM);

        ZTBattleSceneManager.GetInstance().Init();
        //ZTXLuaEnv.GetInstance().Init();
        //测试
        Test();
    }
Beispiel #16
0
    // Use this for initialization
    void Start()
    {
        GameStartEvent.Register(onGameStart);
        PickUpEvent.Register(onCollectableGathered);
        PlayerRespawnEvent.Register(onPlayerRespawn);

        statistics = GameObject.FindGameObjectWithTag("Statistics").GetComponent <Statistics>();

        slider = GetComponentInChildren <CircleSlider>();
        text   = GetComponentInChildren <Text>();
    }
Beispiel #17
0
        private void OnGameStart(GameStartEvent e)
        {
            var enemyRoot = transform.Find("Enemies");

            enemyRoot.gameObject.SetActive(true);

            foreach (Transform childTrans in enemyRoot)
            {
                childTrans.gameObject.SetActive(true);
            }
        }
Beispiel #18
0
        public Bot(GameStartEvent gamestartevent, Action <Move> moveAction, Action <string> reportAction)
        {
            MoveAction   = moveAction;
            ReportAction = reportAction;

            // check who is first
            IsWhite = gamestartevent.white.id == "lorenzobot";
            Engine  = new Engine(IsWhite);

            OnNewMove(gamestartevent.state.moves);
        }
Beispiel #19
0
    private void LoadDataCom(Notification note)
    {
        GameStartEvent.getInstance().removeEventListener(_stateList[_loadIndex].ToString(), LoadDataCom);
        _loadIndex++;
        if (_loadIndex >= _stateList.Count)
        {
            GameStart();
            return;
        }

        LoadDataIndex();
    }
 void Awake()
 {
     CheckpointReachedEvent.Register(OnCheckpointPassed);
     EnemyDeathEvent.Register(onEnemyKilled);
     GameOverEvent.Register(onGameOver);
     PickUpEvent.Register(onPickup);
     PlayerDamagedEvent.Register(onPlayerDamaged);
     PlayerDeathEvent.Register(onPlayerDeath);
     GameStartEvent.Register(onGameStart);
     respawnCounter    = Lives;
     RespawnFadeObject = GameObject.Find(RespawnFadeObjectName);
 }
Beispiel #21
0
    private void LoadDataCom(Notification note)
    {
        GameStartEvent.GetInstance().removeEventListener(_stateList[_loadIndex].ToString(), LoadDataCom);
        _loadIndex++;
        if (_loadIndex >= _stateList.Count)
        {
            //GameStart();
            Debug.Log("GameManager Init Finish");
            return;
        }

        LoadDataIndex();
    }
Beispiel #22
0
    protected void Awake()
    {
        button = GetComponent <Button>();

        if (button == null)
        {
            Debug.LogError($"{name}: unable to find button component!");
        }

        // Register listeners
        GameStartEvent.RegisterListener(GameStart);
        GameOverEvent.RegisterListener(GameOver);
        MenuEvent.RegisterListener(Menu);
    }
    protected void Awake()
    {
        if (NEBound == null || SWBound == null)
        {
            Debug.LogError("Bounds not set!");
        }

        CameraLocked = true;

        // Register listeners
        GameStartEvent.RegisterListener(GameStart);
        GameWonEvent.RegisterListener(GameWon);
        GameOverEvent.RegisterListener(GameOver);
    }
Beispiel #24
0
    //pathJson加载回调
    private static void AssetLoadCallBack(Object target, string path)
    {
        if (null == target)
        {
            return;
        }
        TextAsset    txt        = target as TextAsset;
        JsonPathMode jsonObject = JsonUtility.FromJson <JsonPathMode>(txt.text);

        foreach (var info in jsonObject.infoList)
        {
            pathDic.Add(info.key, info.path);
        }

        GameStartEvent.getInstance().dispatchEvent(GameLoadStepEvent.LOAD_PATH);
    }
Beispiel #25
0
    private static void LoadAssetCom(Object target, string path)
    {
        SpriteAsset spAsset = target as SpriteAsset;

        if (null != spAsset)
        {
            _spAssetDic[spAsset.ID] = spAsset;
        }
        _loadIndex++;
        if (_loadIndex >= _pathList.Count)
        {
            GameStartEvent.getInstance().dispatchEvent(GameLoadStepEvent.LOAD_FACE_ASSET);
            return;
        }
        LoadAsset();
    }
Beispiel #26
0
    /**
     * スタート時処理
     */
    void Start()
    {
        //イベント機能のマネージャーの呼び出し
        _eventManager = new EventManager();

        //リスナーの登録
        _eventManager.RegisterEventHandlers(new HelloListener());    //リスナーサンプル
        _eventManager.RegisterEventHandlers(new HelloListener2());   //リスナーサンプルその2

        //イベントの着火
        GameStartEvent e = new GameStartEvent();

        _eventManager.CallEvent(e);
        //イベントからの取り出し
        print(e.GETStartMessage());
    }
Beispiel #27
0
    protected void Awake()
    {
        if (GridRef == null)
        {
            Debug.LogError($"{name}: no grid object assigned!");
        }

        if (ForbiddenMap == null)
        {
            Debug.LogError($"{name}: no forbidden map assigned!");
        }

        if (ForbiddenTile == null)
        {
            Debug.LogError($"{name}: no forbidden tile assigned!");
        }

        spriteRenderer = GetComponentInChildren <SpriteRenderer>();

        if (spriteRenderer == null)
        {
            Debug.LogError($"{name}: no graphic child game object!");
        }

        gm = FindObjectOfType <GameManager>();

        if (gm == null)
        {
            Debug.LogError($"{name}: no game manager found!");
        }

        defenderMenuButton = FindObjectOfType <DefenderMenuButton>();

        if (defenderMenuButton == null)
        {
            Debug.LogError($"{name}: no defender menu button found!");
        }

        cursor         = spriteRenderer.sprite;
        CursorDisabled = true;

        // Register listeners
        GameOverEvent.RegisterListener(GameOver);
        GameWonEvent.RegisterListener(GameWon);
        GameStartEvent.RegisterListener(GameStart);
        MenuEvent.RegisterListener(Menu);
    }
Beispiel #28
0
    private void StartGameSystem(GameStartEvent e)
    {
        if (player.Pos.y > 10)
        {
            player.Teleport(Vector2.zero);
        }
        GameManager.instance.GameStat = GameStat.Game;
        StartCoroutine(GameReadyRoutin());
        playerLifeCount = 3;

        noneGoal = true;

        goaler    = new List <User>();
        surrender = new List <User>();

        audioSource.Play();
    }
Beispiel #29
0
 public override void FixedUpdate()
 {
     constraint.ForEachGameObject((egoComponent, countDownComponent) => {
         if (countDownComponent.myCountDownStatus == CountDownComponent.CountDownStatus.active)
         {
             egoComponent.gameObject.SetActive(true);
             countDownComponent.timeElapsed += Time.deltaTime;
             if (countDownComponent.timeElapsed >= 3)
             {
                 countDownComponent.myCountDownStatus = CountDownComponent.CountDownStatus.inactive;
                 egoComponent.gameObject.SetActive(false);
                 var e = new GameStartEvent();
                 EgoEvents <GameStartEvent> .AddEvent(e);
             }
         }
     });
 }
Beispiel #30
0
        void Start()
        {
            itemsToInject.Add(config);
            itemsToInject.Add(new GameData());

            systems = FindObjectsOfType <GameSystem>().ToDictionary(x => x.GetType(), x => x);

            ProcessInstallers();

            GameData   = itemsToInject.First(x => x.GetType() == typeof(GameData)) as GameData;
            PlayerData = itemsToInject.First(x => x.GetType() == typeof(PlayerData)) as PlayerData;

            GamePreStartEvent?.Invoke();
            GameStartEvent?.Invoke();

            LaunchStates();
        }
        /// <summary>
        // This method is executed when using this.Publish(new GameStartEvent())
        /// </summary>
        public override void GameStartEventHandler(GameStartEvent data)
        {
            base.GameStartEventHandler(data);
            // Process the commands information.  Also, you can publish new events by using the line below.
            // this.Publish(new AnotherEvent())

            _cubeClicker.Init();
            UpdateHUD();
            SpawnCube();

            this.UpdateAsObservable().Subscribe(_ => {
                UpdateTimeLimit(Time.deltaTime);
            }).DisposeWith(GameHUD);

            Observable.Interval(TimeSpan.FromSeconds(1.0)).Subscribe(_ => {
                SpawnCube();
            }).DisposeWith(CubeSpawn);
        }
Beispiel #32
0
 private void OnGameStart(GameStartEvent evt)
 {
     SetTurn(players[0]);
     SetPhase(Phases.Draw);
     ResetPriority();
 }
Beispiel #33
0
 /// <summary>
 // This method is executed when using this.Publish(new GameStartEvent())
 /// </summary>
 public virtual void GameStartEventHandler(GameStartEvent data)
 {
     // Process the commands information.  Also, you can publish new events by using the line below.
     // this.Publish(new AnotherEvent())
 }
Beispiel #34
0
    void GameStart(GameStartEvent e)
    {
        curStage = GameStage.GameLoop;

        Events.instance.Raise(new IssueOrdersEvent());

        curTurn = GameTurn.IssueOrders;
    }
Beispiel #35
0
 void GameStart(GameStartEvent e)
 {
     Destroy(gameObject);
 }