Beispiel #1
0
        private void Start()
        {
            rayCast = this.gameObject.GetComponent <RayCast>();
            playerSide.items.Clear();
            npcSide.items.Clear();

            playerHero = Instantiate <Unit>(playerHeroCard.unit,
                                            boardState.Value.playerSpawnPosition.position,
                                            boardState.Value.playerSpawnPosition.rotation);

            npcHero = Instantiate <Unit>(npcHeroCard.unit,
                                         boardState.Value.npcSpawnPosition.position,
                                         boardState.Value.npcSpawnPosition.rotation);

            ((NonControllableUnit)npcHero).Initialize(playerHero, npcHeroCard.unitStats, "EnemyTeam");
            ((NonControllableUnit)npcHero).brain.Assign(npcSide);

            ((NonControllableUnit)playerHero).Initialize(npcHero, playerHeroCard.unitStats, "PlayerTeam");
            ((NonControllableUnit)playerHero).brain.Assign(playerSide);

            commander.Initialize(playerHero);
        }
Beispiel #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);
        }
 public KeyboardController(RayCast rayCast)
 {
     this.rayCast = rayCast;
 }