Exemplo n.º 1
0
        void Awake()
        {
            GameManager  GM = GameObject.Find("GameManager").GetComponent <GameManager>();
            Instantiator i  = GameObject.Find("God").GetComponent <Instantiator>();

            GM.sendMessageToChat(i.messageFromPlayer, Message.MessageType.playerMessage);

            Destroy(this);
        }
        void Awake()
        {
            Instantiator i = GameObject.Find("God").GetComponent <Instantiator>();

            i.hero.GetComponent <HeroController>().heroMove(GameManager.Board.getNodeWithRank(i.newpos));
            i.hero   = null;
            i.newpos = 0;
            Destroy(this);
        }
Exemplo n.º 3
0
        void Awake()
        {
            Instantiator i    = GameObject.Find("God").GetComponent <Instantiator>();
            GameManager  GM   = GameObject.Find("GameManager").GetComponent <GameManager>();
            GameObject   hero = GameObject.Find(GM.GetHeroByPID(i.heroDrop));

            hero.GetComponent <HeroController>().dropFarmer();
            i.heroDrop = -1;
            Destroy(this);
        }
        void Awake()
        {
            Instantiator i    = GameObject.Find("God").GetComponent <Instantiator>();
            GameManager  GM   = GameObject.Find("GameManager").GetComponent <GameManager>();
            GameObject   hero = GameObject.Find(GM.GetHeroByPID(i.heroDrinkerID));

            hero.GetComponent <HeroController>().useWell();
            i.heroDrinkerID = -1;
            Destroy(this);
        }
Exemplo n.º 5
0
        void Awake()
        {
            Instantiator i    = GameObject.Find("God").GetComponent <Instantiator>();
            GameManager  GM   = GameObject.Find("GameManager").GetComponent <GameManager>();
            GameObject   hero = GameObject.Find(GM.GetHeroByPID(i.heroEndid));

            hero.GetComponent <HeroController>().hasEndedDay = true;
            GM.nextTurnOrder.Add(i.heroEndid);
            i.heroEndid = -1;
            Destroy(this);
        }
 void Start()
 {
     PV       = GetComponent <PhotonView>();
     God      = GameObject.Find("God").GetComponent <Instantiator>();
     instance = this;
 }
        void Start()
        {
            PV           = GetComponent <PhotonView>();
            GM           = GameObject.Find("GameManager").GetComponent <GameManager>();
            instantiator = GameObject.Find("God").GetComponent <Instantiator>();



            if (PV.IsMine)
            {
                int pid = HeroSelection.HS.mySelectedCharacter;
                PV.RPC("SetUpPlayer", RpcTarget.All, pid);

                if (id == 0)
                {
                    hero   = PhotonNetwork.Instantiate(Path.Combine("Heroes", "Archer"), new Vector3(0, 0, 0), Quaternion.identity);
                    ttHero = PhotonNetwork.Instantiate(Path.Combine("TimeTrack", "ArcherTimetrack"), new Vector3(0, 0, 0), Quaternion.identity);
                }
                else if (id == 1)
                {
                    hero   = PhotonNetwork.Instantiate(Path.Combine("Heroes", "Dwarf"), new Vector3(0, 0, 0), Quaternion.identity);
                    ttHero = PhotonNetwork.Instantiate(Path.Combine("TimeTrack", "DwarfTimetrack"), new Vector3(0, 0, 0), Quaternion.identity);
                }
                else if (id == 2)
                {
                    hero   = PhotonNetwork.Instantiate(Path.Combine("Heroes", "Warrior"), new Vector3(0, 0, 0), Quaternion.identity);
                    ttHero = PhotonNetwork.Instantiate(Path.Combine("TimeTrack", "WarriorTimetrack"), new Vector3(0, 0, 0), Quaternion.identity);
                }
                else
                {
                    hero   = PhotonNetwork.Instantiate(Path.Combine("Heroes", "Wizard"), new Vector3(0, 0, 0), Quaternion.identity);
                    ttHero = PhotonNetwork.Instantiate(Path.Combine("TimeTrack", "WizardTimetrack"), new Vector3(0, 0, 0), Quaternion.identity);
                }



                if (id == 0)
                {
                    hero1 = new Hero(GameManager.game, HeroKind.Archer, hero.GetComponent <HeroController>());
                }
                else if (id == 1)
                {
                    hero1 = new Hero(GameManager.game, HeroKind.Dwarf, hero.GetComponent <HeroController>());
                }
                else if (id == 2)
                {
                    hero1 = new Hero(GameManager.game, HeroKind.Warrior, hero.GetComponent <HeroController>());
                }
                else
                {
                    hero1 = new Hero(GameManager.game, HeroKind.Wizard, hero.GetComponent <HeroController>());
                }

                hero1.setupHero();
                hero.GetComponent <HeroController>().setCurrentPosition(GameManager.Board.getNodeWithRank(hero1.getRank()));
                hero.GetComponent <HeroController>().setBoard(GameManager.Board);
                hero.GetComponent <HeroController>().setHero(hero1);

                hero.GetComponent <HeroController>().setTimeTrack(ttHero.GetComponent <TimeTrackController>());

                hero.GetComponent <HeroController>().nameUI   = GameObject.Find("HeroNameText");
                hero.GetComponent <HeroController>().wpUI     = GameObject.Find("WillpowerValueText");
                hero.GetComponent <HeroController>().spUI     = GameObject.Find("StrengthPointValueText");
                hero.GetComponent <HeroController>().goldUI   = GameObject.Find("GoldValueText");
                hero.GetComponent <HeroController>().farmerUI = GameObject.Find("FarmerValueText");
                hero.GetComponent <HeroController>().psu      = this.GetComponent <PlayerSetUp>();
                ttHero.GetComponent <TimeTrackController>().setTTM(GM.gameObject.GetComponent <TimeTrackManager>());

                hero.GetComponent <HeroController>().items.Add(GameObject.Find("ItemIcon").GetComponent <ItemIcon>());
                hero.GetComponent <HeroController>().items.Add(GameObject.Find("ItemIcon (1)").GetComponent <ItemIcon>());
                hero.GetComponent <HeroController>().items.Add(GameObject.Find("ItemIcon (2)").GetComponent <ItemIcon>());
                hero.GetComponent <HeroController>().items.Add(GameObject.Find("ItemIcon (3)").GetComponent <ItemIcon>());
                hero.GetComponent <HeroController>().items.Add(GameObject.Find("ItemIcon (4)").GetComponent <ItemIcon>());
                //ttHero.GetComponent<TimeTrackController>().ResetTurn();
                MoveBtn         = GameObject.Find("MoveBtn");
                FightBtn        = GameObject.Find("FightButton");
                EndTurnBtn      = GameObject.Find("EndTurnbtn");
                pickUpFarmerBtn = GameObject.Find("PickUpFarmer");
                dropFarmerBtn   = GameObject.Find("DropFarmer");
                endDayBtn       = GameObject.Find("EndDayBtn");



                WellDrinkBtn = GameObject.Find("EndTurnbtn");

                MoveBtn.SetActive(false);
                FightBtn.SetActive(false);
                EndTurnBtn.SetActive(false);
                pickUpFarmerBtn.SetActive(false);
                dropFarmerBtn.SetActive(false);
                endDayBtn.SetActive(false);

                GM.HeroList.Add(hero);
                GM.HeroTTList.Add(ttHero);
            }
            else
            {
                hero   = GameObject.Find(GM.GetHeroByPID(id));
                ttHero = GameObject.Find(GM.GetHeroTTByPID(id));

                if (id == 0)
                {
                    hero1 = new Hero(GameManager.game, HeroKind.Archer, hero.GetComponent <HeroController>());
                }
                else if (id == 1)
                {
                    hero1 = new Hero(GameManager.game, HeroKind.Dwarf, hero.GetComponent <HeroController>());
                }
                else if (id == 2)
                {
                    hero1 = new Hero(GameManager.game, HeroKind.Warrior, hero.GetComponent <HeroController>());
                }
                else
                {
                    hero1 = new Hero(GameManager.game, HeroKind.Wizard, hero.GetComponent <HeroController>());
                }

                hero1.setupHero();
                hero.GetComponent <HeroController>().setCurrentPosition(GameManager.Board.getNodeWithRank(hero1.getRank()));
                hero.GetComponent <HeroController>().setBoard(GameManager.Board);
                hero.GetComponent <HeroController>().setHero(hero1);

                hero.GetComponent <HeroController>().psu = this.GetComponent <PlayerSetUp>();

                hero.GetComponent <HeroController>().setTimeTrack(ttHero.GetComponent <TimeTrackController>());
                ttHero.GetComponent <TimeTrackController>().setTTM(GM.gameObject.GetComponent <TimeTrackManager>());
                //ttHero.GetComponent<TimeTrackController>().ResetTurn();

                GM.HeroList.Add(hero);
            }

            if (GM.HeroList.Count == RoomCustomMatch.room.playersInRoom)
            {
                GM.SetTurnOrder();
            }
        }
Exemplo n.º 8
0
        // Start is called before the first frame update
        void Start()
        {
            GM           = GetComponent <GameManager>();
            Board        = GetComponent <BoardManager>();
            PV           = GetComponent <PhotonView>();
            username     = PlayerPrefs.GetString("MyUsername");
            instantiator = GameObject.Find("God").GetComponent <Instantiator>();



            state = gameState.NEWGAME;
            Game newGame = new Game(Legend.Legend2);

            newGame.initializeLegend();
            game       = newGame;
            difficulty = game.getDifficulty();
            NewGame();

            //machine will update gameState in a while loop
            //and switch case

            /*
             *  while(true){
             *
             *      switch(state){
             *          case gameState.NEWGAME:
             *              newGame();
             *              break;
             *          case gameState.NEWDAY:
             *              newDay();
             *              break;
             *          case gameState.PLAYING:
             *              playing;
             *              break;
             *          case gameState.GAMEOVER:
             *              gameOver();
             *              break;
             *          case gameState.VICTORY:
             *              victory();
             *              break;
             *      }
             *  }
             */

            // below for test, reveal all the fogs

            /*
             * foreach (GameObject fogObject in FogList)
             * {
             *  fogObject.GetComponent<FogController>().getFog().reveal();
             * }
             */
            foreach (EventKind eventkind in System.Enum.GetValues(typeof(EventKind)))
            {
                if (eventkind != EventKind.EventNull)
                {
                    //Debug.Log(eventkind);
                    Event newEvent = new Event(eventkind);
                    EventCards.Add(newEvent);
                }
            }
            // shuffle EventCards
            shuffleEventCards();

            GameObject.Find("Narrator").GetComponent <NarratorController>().show(false);
        }