// FixedUpdate is called 30 times a second
 void FixedUpdate()
 {
     if (Touched())
     {
         if (counter > touchframe + 30)
         {
             touchframe = counter;
         }
     }
     if (counter < touchframe + 30)
     {
         if (counter < touchframe + 15)
         {
             transform.position = transform.TransformPoint(0f, 0f, -0.01f);
         }
         if (counter >= touchframe + 15)
         {
             transform.position = transform.TransformPoint(0f, 0f, 0.01f);
         }
     }
     if (Touched() && counter > lastTouch + 30) // Next question signal
     {
         if (!(currentQuestion + 1 > TextParsing.getQuestions().Length))
         {
             currentQuestion += 1;
         }
         lastTouch       = counter;
         Bubble.bubbled  = false;
         Bubble2.bubbled = false;
         Bubble3.bubbled = false;
         Bubble4.bubbled = false;
         Bubble5.bubbled = false;
         resetCorrectness();
     }
     GameObject.Find("Question Num").GetComponent <TextMesh>().text = currentQuestion.ToString();
     counter++;
 }
 // FixedUpdate is called 30 times a second
 void FixedUpdate()
 {
     if (n == 15) // Should be in start, but need to delay this and I'm a bad programmer
     {
         gameQuestion = GameObject.Find("Question");
         gameA        = GameObject.Find("Answer A");
         gameB        = GameObject.Find("Answer B");
         gameC        = GameObject.Find("Answer C");
         gameD        = GameObject.Find("Answer D");
         gameE        = GameObject.Find("Answer E");
         questions    = TextParsing.getQuestions();
         allAnswers   = TextParsing.getAnswers();
         resetText();
     }
     if (n > 15)
     {
         if (currentQuestion != CurrentQuestionHandler.getCurrentQuestion())
         {
             resetText();
         }
         currentQuestion = CurrentQuestionHandler.getCurrentQuestion();
     }
     n++;
 }
示例#3
0
    void Start()
    {
        if (manager == null)
        {
            DontDestroyOnLoad(gameObject);
            manager = this;
        }
        else
        {
            Destroy(gameObject);
        }
        TextAssets         = Resources.LoadAll <TextAsset>("Factions/");
        FactionGameObjects = new List <GameObject>();

        GameObject UnitPrefab    = Resources.Load <GameObject>("Prefabs/UnitPrefab");
        GameObject HeroPrefab    = Resources.Load <GameObject>("Prefabs/HeroPrefab");
        GameObject SpecialPrefab = Resources.Load <GameObject>("Prefabs/SpecialPrefab");

        foreach (TextAsset t in TextAssets)
        {
            List <GameObject> g = TextParsing.ParseText(t.text);
            for (int i = 0; i < 1; i++)
            {
                foreach (GameObject go in g)
                {
                    FactionGameObjects.Add(go);
                    Faction f = go.GetComponent <Faction>();
                    foreach (Card c in f.Cards)
                    {
                        GameObject wrapper;
                        GameObject wrapper2;
                        if (c.Special)
                        {
                            //instantiate special prefab
                            wrapper  = Instantiate(SpecialPrefab, player1Half.Deck.transform);
                            wrapper2 = Instantiate(SpecialPrefab, player2Half.Deck.transform);
                        }
                        else if (((UnitCard)c).Hero)
                        {
                            //instantiate hero prefab
                            wrapper  = Instantiate(HeroPrefab, player1Half.Deck.transform);
                            wrapper2 = Instantiate(HeroPrefab, player2Half.Deck.transform);
                        }
                        else //regular unit
                        {
                            //instantiate unit prefab
                            wrapper  = Instantiate(UnitPrefab, player1Half.Deck.transform);
                            wrapper2 = Instantiate(UnitPrefab, player2Half.Deck.transform);
                        }
                        //CardGO wrapper = new GameObject().AddComponent<CardGO>();
                        CardGO cardGO  = wrapper.GetComponent <CardGO>();
                        CardGO cardGO2 = wrapper2.GetComponent <CardGO>();
                        cardGO.SetCard(c);
                        cardGO2.SetCard(c);
                        //RectTransform rect = wrapper.GetComponent<RectTransform>();
                        //rect.pivot = new Vector2(0.5f, 0.5f);
                        //rect.anchoredPosition = new Vector2(0.5f, 0.5f);
                        //rect.offsetMax = new Vector2(0.5f, 0.5f);
                        //rect.offsetMin = new Vector2(0.5f, 0.5f);
                        //rect.position = Vector2.zero;
                        player1Half.Deck.AddCard(cardGO);
                        player2Half.Deck.AddCard(cardGO2);
                        wrapper.SetActive(false);
                        wrapper2.SetActive(false);
                    }
                    Faction.CloneTo(f, gameObject);
                }
            }
            foreach (GameObject go in g)
            {
                Destroy(go);
            }
        }

        int[] deck = new int[] { 1, 3, 6, 9, 10, 14, 18, 11, 11, 12, 12, 13,
                                 100, 101, 101, 102, 102, 102, 103, 103, 106, 107, 108, 109, 119, 121, 122, 122 };

        //PlayerOnesTurn = (Random.Range(0, 2) == 1) ? true : false;
        PlayerOnesTurn = true;


        //set up board
        InitialiseZone(player1Half, true);
        InitialiseZone(player2Half, false);
        weather.Type      = Zone.Types.Weather;
        weather.VisibleTo = Zone.IsVisibleTo.Both;
        highlightedZones  = new List <Zone>();

        StartCoroutine(DrawCards());
    }