Ejemplo n.º 1
0
        private void displayCard(SkillCardModel card, Vector3 vector)
        {
            GameObject          newCard = Instantiate(skillcardPrefab, vector, Quaternion.identity);
            SkillCardController cont    = newCard.GetComponent <SkillCardController>();

            cont.model = card;
            cont.setView();
            displayedCards.Add(newCard);
        }
Ejemplo n.º 2
0
        public List <SkillCardModel> getSelectedCards()
        {
            List <SkillCardModel> cards = new List <SkillCardModel>();
            List <GameObject>     tmp   = new List <GameObject>();

            foreach (var card in displayedCards)
            {
                SkillCardController skc = card.GetComponent <SkillCardController>();
                if (skc.isSelected())
                {
                    cards.Add(skc.model);
                    hand.Remove(skc.model);
                    tmp.Add(card);
                }
            }
            while (tmp.Count > 0)
            {
                Destroy(tmp[0]);
                displayedCards.Remove(tmp[0]);
                tmp.RemoveAt(0);
            }
            return(cards);
        }
Ejemplo n.º 3
0
    void Start()
    {
        //positionHolders = new List<GameObject>(GameObject.FindGameObjectsWithTag("PositionPlaceholder"));

        idolHUDPanel   = GameObject.Find("IdolHUDs");
        skillHUDPanel  = GameObject.Find("SkillHUD");
        originalHUDPos = skillHUDPanel.transform.localPosition;
        RectTransform rt = skillHUDPanel.transform.GetComponent <RectTransform>();

        hudOffscreenPos = originalHUDPos;
        //hudOffscreenPos.x += rt.sizeDelta.x * rt.localScale.x;
        hudOffscreenPos.x = rt.rect.width;
        print(hudOffscreenPos.x + "");

        skillCards[0] = GameObject.Find("SkillCard (0)").GetComponent <SkillCardController>();
        skillCards[1] = GameObject.Find("SkillCard (1)").GetComponent <SkillCardController>();
        skillCards[2] = GameObject.Find("SkillCard (2)").GetComponent <SkillCardController>();
        skillCards[3] = GameObject.Find("SkillCard (3)").GetComponent <SkillCardController>();
        skillCards[4] = GameObject.Find("SkillCard (4)").GetComponent <SkillCardController>();

        currentSkillPanel = GameObject.Find("CurrentSkill");
        currentSkillPanel.SetActive(false);
        currentSkillCard = currentSkillPanel.GetComponentInChildren <SkillCardController>();

        position1 = GameObject.Find("position1");
        position1.gameObject.GetComponent <SpriteRenderer>().sortingLayerName = backgroundLayer;
        position2 = GameObject.Find("position2");
        position2.gameObject.GetComponent <SpriteRenderer>().sortingLayerName = backgroundLayer;
        position3 = GameObject.Find("position3");
        position3.gameObject.GetComponent <SpriteRenderer>().sortingLayerName = backgroundLayer;



        idols = new List <IdolStateMachine>();

        GameObject       idol  = (GameObject)UnityEditor.AssetDatabase.LoadAssetAtPath <Object>("Assets/Prefabs/Idol Achan.prefab");
        GameObject       clone = GameObject.Instantiate(idol, position1.transform.position, idol.transform.rotation);
        IdolStateMachine ism   = clone.GetComponent <IdolStateMachine>();

        ism.setHUD(GameObject.Find("IdolHUD (1)").transform);

        idols.Add(ism);


        idol  = (GameObject)UnityEditor.AssetDatabase.LoadAssetAtPath <Object>("Assets/Prefabs/Idol Bchan.prefab");
        clone = GameObject.Instantiate(idol, position2.transform.position, idol.transform.rotation);
        ism   = clone.GetComponent <IdolStateMachine>();
        ism.setHUD(GameObject.Find("IdolHUD (2)").transform);

        idols.Add(ism);


        idol  = (GameObject)UnityEditor.AssetDatabase.LoadAssetAtPath <Object>("Assets/Prefabs/Idol Cchan.prefab");
        clone = GameObject.Instantiate(idol, position3.transform.position, idol.transform.rotation);
        ism   = clone.GetComponent <IdolStateMachine>();
        ism.setHUD(GameObject.Find("IdolHUD (3)").transform);

        idols.Add(ism);

        currentState = BattleState.STARTING;

        crowdMan = new CrowdController();
    }