Esempio n. 1
0
        private void SwitchUnit(int index)
        {
            units[index].transform.position = currentUnit.transform.position;
            units[index].transform.rotation = currentUnit.transform.rotation;
            units[index].gameObject.SetActive(true);
            playerUnits.items[0] = units[index];
            currentUnit.gameObject.SetActive(false);
            currentUnit     = units[index];
            currentAnimator = currentUnit.GetComponentInChildren <Animator>();
            //Animation

            EncounterController.instance.activeHero = currentUnit;
            GetComponent <CameraController>().UpdateTarget(currentUnit.gameObject);

            spellCasting.CancelCast();
            spellCasting.UpdateSpellBook(ref currentUnit.spellBook);
        }
Esempio n. 2
0
        private void Awake()
        {
            rayCast            = this.GetComponent <Prototype.RayCast>();
            joystickController = new JoystickController();
            keyboardController = new KeyboardController(rayCast);
            spellCasting       = new SpellCasting(this);

            playerUnits.items.Clear();
            for (int i = 0; i < units.Length && units[i] != null; i++)
            {
                unitPortraits[i].gameObject.SetActive(true);
                units[i] = Instantiate(units[i]);
                units[i].gameObject.SetActive(false);
                units[i].Initialize(this, unitPortraits[i]);
            }
            currentUnit     = units[0];
            currentAnimator = currentUnit.GetComponentInChildren <Animator>();
            currentUnit.transform.position = playerSpawn;
            currentUnit.gameObject.SetActive(true);
            playerUnits.Add(currentUnit);
            GetComponent <CameraController>().UpdateTarget(currentUnit.gameObject);
            spellCasting.UpdateSpellBook(ref currentUnit.spellBook);
        }