Esempio n. 1
0
 public void TryInstantiateSpell(SpellSpawner spawner)
 {
     if (_spellData.CurrentUsableCharges > 0)
     {
         _spellData.CurrentUsableCharges--;
         Instantiate(Spell.Prefab, spawner.transform.position, spawner.transform.rotation);
     }
 }
Esempio n. 2
0
    private void Update()
    {
        ability1Icon.enabled = false;
        ability1Text.text    = "Ability 1";
        ability2Icon.enabled = false;
        ability2Text.text    = "Ability 2";
        ability3Icon.enabled = false;
        ability3Text.text    = "Ability 3";

        if (SessionManager.PlayerInventory.Count > 0)
        {
            a1 = SessionManager.PlayerInventory[0];
            ability1Icon.enabled = true;
            ability1Icon.sprite  = iconsDictionary[a1];
            ability1Text.text    = a1.ToString();
        }


        if (SessionManager.PlayerInventory.Count > 1)
        {
            a2 = SessionManager.PlayerInventory[1];
            ability2Icon.enabled = true;
            ability2Icon.sprite  = iconsDictionary[a2];
            ability2Text.text    = a2.ToString();
        }


        if (SessionManager.PlayerInventory.Count > 2)
        {
            a3 = SessionManager.PlayerInventory[2];
            ability3Icon.enabled = true;
            ability3Icon.sprite  = iconsDictionary[a3];
            ability3Text.text    = a3.ToString();
        }



        if (!Weapon.abilityActive)
        {
            if (SpellSpawner.GetAbilityType(a1) == WeaponType.Ability)
            {
                ability1Icon.enabled = false;
                ability1Text.text    = "USED";
            }
            if (SpellSpawner.GetAbilityType(a2) == WeaponType.Ability)
            {
                ability2Icon.enabled = false;
                ability2Text.text    = "USED";
            }
            if (SpellSpawner.GetAbilityType(a3) == WeaponType.Ability)
            {
                ability3Icon.enabled = false;
                ability3Text.text    = "USED";
            }
        }

        hpBar.fillAmount = player.HealthPercent;
    }
Esempio n. 3
0
	void Start(){
		movementManager = 	GetComponent<MovementManager> ();
		playerSpawner = 	GetComponent<PlayerSpawner> ();
		player = 			GetComponent<Player> ();
		elementSpawner = 	GetComponent<ElementSpawner> ();
		spellSpawner = 		GetComponent<SpellSpawner> ();
		shieldSpawner = 	GetComponent<ShieldSpawner> ();
		audioManager = 		GetComponent<AudioManager> ();
	}
Esempio n. 4
0
    public void InitiateLevel()
    {
        GameObject   player       = GameObject.FindGameObjectWithTag("Player");
        SpellSpawner spellSpawner = player.GetComponentInChildren <SpellSpawner>();

        Debug.Log("Spawning");
        LpPlayer.acquiredLPs = new List <Abilities>();

        foreach (Abilities a in playerInventory)
        {
            spellSpawner.SpawnAbility(a);
        }
    }
Esempio n. 5
0
    public void AddAbility(Abilities a)
    {
        for (int i = 0; i < playerInventory.Count; ++i)
        {
            if (SpellSpawner.IsSameType(a, (Abilities)playerInventory[i]))
            {
                playerInventory[i] = a;
                return;
            }
        }

        playerInventory.Add(a);
    }
Esempio n. 6
0
    private void Start()
    {
        SpellSpawner sp = GetComponentInParent <SpellSpawner>();

        if (sp != null)
        {
            if (sp.currentWeapon != null && weaponType == WeaponType.Attack)
            {
                Destroy(sp.currentWeapon.gameObject);
                sp.currentWeapon = this;
            }

            if (sp.currentWeapon != null && weaponType == WeaponType.Ability)
            {
                Destroy(sp.currentAbility.gameObject);
                sp.currentAbility = this;
            }
        }

        if (weaponType == WeaponType.Ability)
        {
            Weapon.abilityActive = true;
        }
    }
Esempio n. 7
0
	void Awake () {
		//singleton
		instance = this;
	}
Esempio n. 8
0
 public void Initialize(SpellSpawner spawner, Vector3 position)
 {
     this.spawner            = spawner;
     this.transform.position = position;
 }
Esempio n. 9
0
 public static bool IsSameType(Abilities a, Abilities b)
 {
     return(SpellSpawner.GetAbilityType(a) == SpellSpawner.GetAbilityType(b));
 }
Esempio n. 10
0
 void Start()
 {
     m_SpellPool    = GetComponent <SpellPool>();
     m_SpellSpawner = GetComponent <SpellSpawner>();
 }