Inheritance: MonoBehaviour
示例#1
0
 public override void OnPhotonPlayerDisconnected(PhotonPlayer other)
 {
     Debug.Log(other.NickName + " left!");
     RoundController.SwitchState(GameState.Disconnecting);
     disconnect = true;
     timer      = 5;
 }
示例#2
0
    private void NolanMove(Character chara, RoomContraller roomContraller, EventController eventController, DiceRollCtrl diceRoll, APathManager aPathManager,
                           RoundController roundController, BattleController battleController)
    {
        Character player = roundController.getPlayerChara();

        if (AutoMoveManager.move(chara, roomContraller, eventController, diceRoll, aPathManager, player.getCurrentRoom()))
        {
            //找到房间后, 等待后续细节,:根据设定找下一个房间? 开启剧本? 目前直接结束回合
            Debug.Log(chara.getName() + "已经到达目标房间 (" + chara.getCurrentRoom()[0] + "," + chara.getCurrentRoom()[1] + ")");
            Debug.Log("直接开打,开始疯狂攻击玩家");

            battleController.fighte(chara, player);

            if (typeof(NPC).IsAssignableFrom(chara.GetType()))
            {
                Debug.Log("该角色是属于NPC");
                NPC npc = (NPC)chara;
                //角色行动 找物品
            }
            else
            {
                Debug.Log("该角色是属于怪物");
            };
        }
    }
        public void CreateShouldSaveRound()
        {
            //ARRANGE
            var model = new CreateRoundViewModel {
                Level = new LevelEntity {
                    Id = Guid.NewGuid()
                }
            };

            var logic = new Mock <IRoundLogic>();

            logic
            .Setup(x => x.Create(It.IsAny <RoundEntity>()))
            .Verifiable("Should save round.");

            var controller = new RoundController(logic.Object, null, null);

            //ACT
            var result = controller.Create(model) as RedirectToRouteResult;

            //ASSERT
            logic.Verify();

            Assert.NotNull(result);
            Assert.AreEqual("Index", result.RouteValues["Action"]);
        }
    public bool getConditionStatus(Character chara, RoomInterface room, RoundController roundController)
    {
        NPC         npc = (NPC)chara;
        List <Item> its = npc.getBag().getAllItems();
        bool        c1  = false;
        bool        c2  = false;

        for (int i = 0; i < its.Count; i++)
        {
            if (its[i].getCode() == ItemConstant.ITEM_CODE_SPEC_Y0003 )
            {
                Debug.Log("检查剧情开启:找到任务道具" + its[i].getName());
                c1 = true;
            }
            if (its[i].getCode() == ItemConstant.ITEM_CODE_SPEC_Y0004)
            {
                Debug.Log("检查剧情开启:找到任务道具" + its[i].getName());
                c2 = true;
            }
        }
        if (c1 && c2)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
    public bool checkStatus(Character chara, RoomInterface room, RoundController roundController)
    {
        bool winc = true;

        for (int i = 0; i < winConditions.Count; i++)
        {
            if (!winConditions[i].getConditionStatus(chara, room, roundController))
            {
                winc = false;
                break;
            }
        }
        if (winc)
        {
            Kate kete = (Kate)roundController.getCharaByName(SystemConstant.P4_NAME);
            if (kete.isDead())
            {
                this.endFlag = 0;
            }
            else
            {
                this.endFlag = 1;
            }
        }
        Debug.Log("检查好人胜利条件:" + winc);
        this.winResult = winc;
        return(winc);
    }
示例#6
0
    public void NextCombatant()
    {
        index++;
        if (index >= order.Count)
        {
            RoundController.SwitchState(GameState.Cards);
            return;
        }
        Debug.Log(index + ". " + order[index].name + " Starts turn.");
        List <UnitController> targets = new List <UnitController>();
        IPlayerControl        owner;

        if (pc.isOwner(order[index]))
        {
            owner = ec;
        }
        else
        {
            owner = pc;
        }
        targets.AddRange(owner.GetUnits());
        //for (int i = 0; i < targets.Count; i++) {
        foreach (var item in targets.ToArray())
        {
            float distance = Vector3.Distance(order[index].transform.position, item.transform.position);
            if (distance > order[index].range)
            {
                targets.Remove(item);
            }
        }
        Debug.Log("Proceed to attack " + targets.Count + " targets");
        Attack(targets.ToArray(), owner);
    }
        public void UpdateShouldSaveTheRound()
        {
            //ARRANGE
            var model = new UpdateRoundViewModel {
                Id = Guid.NewGuid(), Level = new LevelEntity {
                    Id = Guid.NewGuid()
                }
            };
            var profileToUpdate = new RoundEntity();

            var logic = new Mock <IRoundLogic>();

            logic
            .Setup(x => x.Get(model.Id))
            .Returns(profileToUpdate)
            .Verifiable("Should get the game to update");
            logic
            .Setup(x => x.Update(profileToUpdate))
            .Verifiable("Should save the changes");

            var controller = new RoundController(logic.Object, null, null);

            //ACT
            var result = controller.Update(model) as RedirectToRouteResult;

            //ASSERT
            logic.Verify();

            Assert.NotNull(result);
            Assert.AreEqual("Index", result.RouteValues["Action"]);
        }
示例#8
0
    public static void TurnOnOff(bool setActive, string gameState = "GAME OVER")
    {
        BeatManager.StopMusic();
        instance.gameObject.SetActive(setActive);
        instance.enabled = true;
        Debug.Log("We are scoreer");
        if (setActive)
        {
            //FindObjectOfType<PlayerEngine>().gameObject.SetActive(false);

            BeatManager.StopMusic();
            RoundController.PauseRound(true);
            instance.gameState.text     = gameState;
            instance.CurrentScore.text  = StreakCounterUI.scoreToPrint.ToString();
            instance.EnemyKills.text    = RoundController.EnemiesKilled.ToString();
            instance.SyncedHits.text    = StreakCounterUI.HitsOnBeat.ToString();
            instance.BestHitStreak.text = StreakCounterUI.TopHitsInArow.ToString();
            instance.Deaths.text        = StreakCounterUI.DeathCount.ToString();

            instance.scoreToPrintScore  = StreakCounterUI.scoreToPrint;
            instance.topHitsScore       = StreakCounterUI.TopHitsInArow; //
            instance.enemiesKileldScore = RoundController.EnemiesKilled; //
            instance.hitsOnBeatScore    = StreakCounterUI.HitsOnBeat;    //
            instance.deathcountScore    = StreakCounterUI.DeathCount;    //
            instance.Invoke("CalculateScore", 0.5f);
        }
    }
示例#9
0
    void Start()
    {
        GameStatus     = GameState.Main;
        carModelNumber = UnityEngine.Random.Range(1, 7);

        float start = Time.unscaledTime;

        for (int i = 0; i < 6; i++)
        {
            string modelPath = string.Format(carPath, carModelNumber, carColors[i]);
            Debug.Log("Loading: " + modelPath);
            carPrefabs[i] = Resources.Load <GameObject>(modelPath);
        }

        Debug.Log("Load models time: " + (Time.unscaledTime - start));

        roundController        = GameObject.Find("RoundController").GetComponent <RoundController>();
        roundController.server = this;

        car_prefab = Resources.Load <GameObject>("CarController");
        DontDestroyOnLoad(gameObject);
        players = new List <CarController>();
        wss     = new GameSocketServer("ws://localhost:8888");
        // Client controller has a callback to this class in which we instanceiate the gameopbject (must be done in main)
#pragma warning disable CS0618 // Type or member is obsolete
        wss.AddWebSocketService("/server", () => new ClientController(this)
        {
        });
#pragma warning restore CS0618 // Type or member is obsolete
        InvokeRepeating("TickUpdate", 0f, TickRate);
        wss.Start();
        Debug.Log("WSS Running");
    }
示例#10
0
 public void AddController(AController c)
 {
     if (c is PlayerController)
     {
         player = (PlayerController)c;
     }
     else if (c is AudioManager)
     {
         audioManager = (AudioManager)c;
     }
     else if (c is SlotsController)
     {
         slotsController = (SlotsController)c;
     }
     else if (c is UIController)
     {
         uiController = (UIController)c;
     }
     else if (c is RoundController)
     {
         roundController = (RoundController)c;
     }
     //else if (c is CheckpointController)
     //checkpointController = (CheckpointController)c;
 }
示例#11
0
    protected void Start()
    {
        this.turnController  = GlobalControl.Instance.turnController;
        this.roundController = GlobalControl.Instance.roundController;
        this.state           = turnController.State;

        if (GlobalControl.Instance.NewGame)
        {
            state.ResetGame();
            ShufflePlayers();

            turnController.NewGame(this.state);
        }

        overlay         = GetComponentInChildren <Canvas>().gameObject;
        roundsText.text = roundController.GetRoundsText();

        tokenSpawnParticles = GetComponentInChildren <ParticleSystem>();
        tokenSpawnParticles.transform.position = tokenSpawn.position;

        CreateTags();

        state.CurrentPlayer.MyTurn     = true;
        GlobalControl.Instance.NewGame = false;

        turnController.UpdateUndoRedoButtons();
    }
示例#12
0
    public override void initStroy(Character chara, RoundController roundController, TaskMananger taskMananger)
    {
        string     monsteUrl     = "Prefabs/Monsters/BenMonster";
        GameObject servantObject = Instantiate(Resources.Load(monsteUrl)) as GameObject;
        BenMonster benMonster    = servantObject.GetComponent <BenMonster>();

        benMonster.setCurrentRoom(chara.getCurrentRoom());
        benMonster.init();
        roundController.setEndRound(benMonster);

        Character[] charas = roundController.getAllChara();

        Debug.Log("UI 显示《《剧情模式已经开启: " + this.getStoryInfo());
        chara.setScriptAction(this.getBadManScript());
        chara.setBoss(true);
        for (int i = 0; i < charas.Length; i++)
        {
            if (charas[i].getName() != chara.getName())
            {
                charas[i].setScriptAction(this.getGoodManScript());
                charas[i].setBoss(false);
            }
        }

        // init story task..
        initTask(taskMananger, chara, benMonster);
    }
示例#13
0
    // Use this for initialization
    void Start()
    {
        gameState       = FindObjectOfType <GameState>();
        roundController = FindObjectOfType <RoundController>();

        string datapath = "Resources/data/skill.json";
        string filePath = Path.Combine(Application.dataPath, datapath);

        if (File.Exists(filePath))
        {
            string      dataAsJson = File.ReadAllText(filePath);
            SkillConfig loadedData = JsonUtility.FromJson <SkillConfig>(dataAsJson);
            Debug.Log(loadedData);
        }
        else
        {
            Debug.Log("Not exists");
        }

        //ActionConfig actionConfig = ActionUtils.Instance.LoadAction("GenericAction");



        GameControll();
    }
示例#14
0
文件: Count.cs 项目: wsc16340223/3d-4
    // Update is called once per frame
    void Update()
    {
        if (!active)
        {
            return;
        }
        // 不活跃

        beginTime -= Time.deltaTime;
        if (beginTime > 0)
        {
            centerText.text = "     " + countingNumber();
        }
        else
        {
            centerText.text = "";
            SceneController scene = Singleton <SceneController> .Instance;
            scene.nowState = Status.GAMING;

            RoundController round = Singleton <RoundController> .Instance;
            round.runRound();

            active = false;
            // 设置为不活跃
        }
    }
    private void P3Move(Character chara, RoomContraller roomContraller, EventController eventController, DiceRollCtrl diceRoll, APathManager aPathManager,
                        RoundController roundController, BattleController battleController)
    {
        NPC npc = (NPC)chara;

        if (P3Message.Count > 0)
        {
            npc.sendMessageToPlayer(P3Message.Dequeue());
        }
        Character kate = roundController.getCharaByName(SystemConstant.P4_NAME);

        if (!kate.isDead())
        {
            if (AutoMoveManager.move(chara, roomContraller, eventController, diceRoll, aPathManager, kate.getCurrentRoom()))
            {
                battleController.fighte(chara, kate);
                if (kate.isDead())
                {
                    P3Message.Enqueue(new string[] { "侦探死了?", "感谢神灵保佑,我永远是您忠实的仆从。", "哼,那个蜘蛛怪怕除虫剂的,随随便便就收拾了。" });
                }
            }
        }
        else
        {
            AutoMoveManager.move(chara, roomContraller, eventController, diceRoll, aPathManager, roomContraller.getRandomRoom().getXYZ());
        }
    }
示例#16
0
    void Start()
    {
        roundController = FindObjectOfType <RoundController>();
        roomContraller  = FindObjectOfType <RoomContraller>();
        miniMapUI       = FindObjectOfType <MiniMapUI>();

        newDi1 = Instantiate(minRoom) as GameObject;
        newDi1.GetComponent <RectTransform>().SetParent(MinMapPlane.transform);
        newDi1.GetComponent <RectTransform>().localPosition = showMPos;

        newDi2 = Instantiate(minRoom) as GameObject;
        newDi2.GetComponent <RectTransform>().SetParent(MinMapPlane.transform);
        // newDi2.GetComponent<RectTransform>().localPosition = show2Pos;
        newDi2.SetActive(false);
        newDi3 = Instantiate(minRoom) as GameObject;
        newDi3.GetComponent <RectTransform>().SetParent(MinMapPlane.transform);
        //newDi3.GetComponent<RectTransform>().localPosition = show1Pos;
        newDi3.SetActive(false);
        newDi4 = Instantiate(minRoom) as GameObject;
        newDi4.GetComponent <RectTransform>().SetParent(MinMapPlane.transform);
        // newDi4.GetComponent<RectTransform>().localPosition = show1Pos;
        newDi4.SetActive(false);
        newDi5 = Instantiate(minRoom) as GameObject;
        newDi5.GetComponent <RectTransform>().SetParent(MinMapPlane.transform);
        newDi5.SetActive(false);
        // newDi5.GetComponent<RectTransform>().localPosition = show1Pos;
        east  = new int[] { 0, 0, 0 };
        west  = new int[] { 0, 0, 0 };
        north = new int[] { 0, 0, 0 };
        south = new int[] { 0, 0, 0 };
    }
示例#17
0
    // 回调函数
    public void SSEventAction(SSAction source, SSActionEventType events = SSActionEventType.COMPLETED,
                              int intParam = 0, string strParam = null, Object objParam = null)
    {
        if (events == SSActionEventType.COMPLETED)
        // 落到y轴以下
        {
            isLose = true;
            sumNum--;
        }
        else
        {
            sumNum--;
        }

        if (sumNum == 0)
        // 如果本回合结束
        {
            SceneController scene = Singleton <SceneController> .Instance;
            if (isLose)
            {
                centerText.text = "LOSE";
                scene.nowState  = Status.OVER;
            }
            else
            {
                RoundController round = Singleton <RoundController> .Instance;
                round.NextRound();
                scene.nowState = Status.WATING;
            }
        }
    }
示例#18
0
    public void DisplayCheckboxes()
    {
//		toggleCall.isOn = false;
//		toggleCallAny.isOn = false;
//		toggleCheck.isOn = false;
//		toggleFold.isOn = false;

        double minBetAmount = 0;

        if (UIManager.Instance.gameType == POKER_GAME_TYPE.TEXAS)
        {
            minBetAmount = RoundController.GetInstance().GetMinBetAmountInCurrentRound() - TexassGame.Instance.ownTexassPlayer.betAmount;
            minBetAmount = minBetAmount > TexassGame.Instance.ownTexassPlayer.buyInAmount ? TexassGame.Instance.ownTexassPlayer.buyInAmount : minBetAmount;
        }
        else if (UIManager.Instance.gameType == POKER_GAME_TYPE.WHOOPASS)
        {
            minBetAmount = RoundController.GetInstance().GetMinBetAmountInCurrentRound() - WhoopAssGame.Instance.ownWhoopAssPlayer.betAmount;
            minBetAmount = minBetAmount > WhoopAssGame.Instance.ownWhoopAssPlayer.buyInAmount ? WhoopAssGame.Instance.ownWhoopAssPlayer.buyInAmount : minBetAmount;
        }

        if (minBetAmount <= 0)
        {
            cgCheck.interactable = true;
        }
        else
        {
            cgCheck.interactable = false;

            txtCall.text           = "   Call " + Utility.GetAmount(minBetAmount);
            cgCall.interactable    = true;
            cgCallAny.interactable = true;
        }

        cgFold.interactable = true;
    }
示例#19
0
    // Unity fires off this function
    void Start()
    {
        // Find the common objects we use.  These are created by unity.
        cc            = GameObject.FindObjectOfType <CameraController>();
        uICanvas      = GameObject.Find("UICanvas").GetComponent <Canvas>();
        boardCanvas   = GameObject.Find("BoardCanvas").GetComponent <Canvas>();
        tokenCanvas   = GameObject.Find("TokenCanvas").GetComponent <Canvas>();
        tokenBoard    = GameObject.FindObjectOfType <TokenBoard>();
        heroCanvas    = GameObject.FindObjectOfType <HeroCanvas>();
        monsterCanvas = GameObject.FindObjectOfType <MonsterCanvas>();

        // Create some things
        uiScaler     = new UIScaler(uICanvas);
        config       = new ConfigFile();
        roundControl = new RoundController();

        // Read the version and add it to the log
        TextAsset versionFile = Resources.Load("version") as TextAsset;

        version = versionFile.text.Trim();
        // The newline at the end stops the stack trace appearing in the log
        Debug.Log("Valkyrie Version: " + version + System.Environment.NewLine);

        // Bring up the Game selector
        new GameSelection();
    }
示例#20
0
 public void Init()
 {
     if(instance == null){
         instance = this;
         nextRoundStartTime = Time.time;
     }
 }
示例#21
0
 private void Start()
 {
     roundController    = GameObject.Find("Round Controller").GetComponent <RoundController>();
     health             = Globals.currentDifficulty.zombieBaseHealth;
     navMeshAgent.speed = Globals.currentDifficulty.zombieBaseSpeed;
     player             = GameObject.Find("Main Camera").transform;
 }
示例#22
0
 private void Start()
 {
     roundController  = GameController.instance.roundController;
     actionController = GameController.instance.actionController;
     gameController   = GetComponent <GameController>();
     boardSelection   = GetComponent <BoardSelection>();
 }
    private void Awake()
    {
        _playerHUD       = GetComponent <PlayerHUD>();
        _roundController = FindObjectOfType <RoundController>();

        Init();
    }
示例#24
0
 // Use this for initialization
 void Start()
 {
     roundController = FindObjectOfType <RoundController>();
     roomContraller  = FindObjectOfType <RoomContraller>();
     diceRoll        = FindObjectOfType <DiceRollCtrl>();
     confirmUI       = FindObjectOfType <ConfirmManageUI>();
     camCtrl         = FindObjectOfType <CameraCtrl>();
 }
示例#25
0
    private void Awake()
    {
        GameObject gameController = GameObject.FindGameObjectWithTag("GameController");

        gameManager     = gameController.GetComponent <GameManager>();
        gameState       = gameController.GetComponent <GameState>();
        roundController = gameController.GetComponent <RoundController>();
    }
示例#26
0
 public void LoadResources()
 {
     wall = (GameObject)Instantiate(Resources.Load("wall"), new Vector3(7, 0, 15), Quaternion.identity);
     Player          initial_p   = Player.Instance;
     ClayPigeonFirer initial_cpf = ClayPigeonFirer.Instance;
     ScoreController initial_s   = ScoreController.Instance;
     RoundController initial_r   = RoundController.Instance;
 }
示例#27
0
 void Start()
 {
     map = GameObject.Find("Map").gameObject;
     cameraController = GameObject.Find("Main Camera").GetComponent <CameraController>();
     roundController  = GameObject.Find("CalculatorCanvas").GetComponent <RoundController>();
     piecePlace       = GameObject.Find("LevelManager").GetComponent <PiecePlace>();
     levelManager     = GameObject.Find("LevelManager").GetComponent <LevelManager>();
 }
示例#28
0
 public override void OnPhotonPlayerConnected(PhotonPlayer other)
 {
     Debug.Log(other.NickName + " joined!");
     //	PhotonNetwork.Instantiate("Test", Vector3.zero, Quaternion.identity, 1);
     //PhotonNetwork.Instantiate("Test", Vector3.zero, Quaternion.identity, 1);
     //PhotonNetwork.Instantiate("LeCardsObj", Vector3.zero, Quaternion.identity, 1);
     RoundController.SwitchState(GameState.Deployment);
 }
 /// <summary>
 /// Initializes singleton instance.
 /// </summary>
 /// <exception cref="Exception">If there is more than one instance</exception>
 private void Awake()
 {
     if (instance != null)
     {
         throw new Exception("Multiple RoundSystems exist!");
     }
     instance = this;
 }
示例#30
0
 // Use this for initialization
 void Start()
 {
     duiHuaUImanager   = FindObjectOfType <DuiHuaUImanager>();
     roundController   = FindObjectOfType <RoundController>();
     guangBoController = FindObjectOfType <GuangBoController>();
     confirmUI         = FindObjectOfType <ConfirmManageUI>();
     //recevor = GetComponent<Animator>();
 }
    private void P5Move(Character chara, RoomContraller roomContraller, EventController eventController, DiceRollCtrl diceRoll, APathManager aPathManager,
                        RoundController roundController, BattleController battleController)
    {
        Character monster = roundController.getCharaByName(SystemConstant.MONSTER1_NAME);
        string    roomType;
        NPC       npc = (NPC)chara;

        if (this.P5TargetRooms.Count >= 1)
        {
            roomType = this.P5TargetRooms.Peek();
            if (P5Message.Count > 0)
            {
                npc.sendMessageToPlayer(P5Message.Dequeue());
            }
        }
        else
        {
            if (P5Message.Count > 0)
            {
                npc.sendMessageToPlayer(P5Message.Dequeue());
            }

            if (monster.isDead())
            {
                if (P5Message.Count > 0)
                {
                    npc.sendMessageToPlayer(P5Message.Dequeue());
                }
                roomType = roomContraller.getRandomRoom().getRoomType();
            }
            else
            {
                roomType = roomContraller.findRoomByXYZ(monster.getCurrentRoom()).getRoomType();
            }
            this.P5TargetRooms.Enqueue(roomType);
        }
        if (AutoMoveManager.move(chara, roomContraller,
                                 eventController, diceRoll, aPathManager, roomContraller.findRoomByRoomType(roomType).getXYZ()))
        {
            this.P5TargetRooms.Dequeue();

            if (roomType == RoomConstant.ROOM_TYPE_HOSPITAIL_MINITOR)
            {
                npc.sendMessageToPlayer(new string[] { "我在监控室了,这个有台电脑。", "我破解了文件夹,里面有很多照片,有一张很奇怪,大家来看看。" });
            }
            else
            {
                if (!monster.isDead())
                {
                    battleController.fighte(chara, monster);
                    if (monster.isDead())
                    {
                        P1Message.Enqueue(new string[] { "那个蜘蛛怪已经死了!。", "那个萝莉侦探还管不管了啊?" });
                    }
                }
            }
        }
    }
示例#32
0
 void Start()
 {
     board = GetComponentInChildren<Board>();
     turnController = GetComponent<RoundController>();
     Populate ();
     turn = turnController.Tick();
     turn.MoveNext();
     current = (Unit)turn.Current;
     ChangeState<PreTurnState>();
 }
示例#33
0
 // Use this for initialization
 void Start()
 {
     instance = this;
     t = this.GetComponent<TimeController> ();
 }