private void FadeOutToast(GameToast toast)
    {
        object[]  args      = new object[] { "amount", 0f, "delay", 4f, "time", 0.25f, "easeType", iTween.EaseType.easeInCubic, "oncomplete", "DeactivateToast", "oncompletetarget", base.gameObject, "oncompleteparams", toast };
        Hashtable hashtable = iTween.Hash(args);

        iTween.FadeTo(toast.gameObject, hashtable);
    }
Exemple #2
0
    IEnumerator SpawnWave()
    {
        waveNumber++;

        EnemyWave[] wave = territory.waves[waveNumber - 1];

        EnemiesAlive = 0;

        for (int i = 0; i < wave.Length; i++)
        {
            if (wave[i].type != Attacker.Type.None)
            {
                EnemiesAlive += wave[i].count;
            }
        }
        string s = string.Format("Wave {0} ({1} enemies)", waveNumber, EnemiesAlive);

        //Debug.Log(s);
        GameToast.Add(s);
        for (int i = 0; i < wave.Length; i++)
        {
            for (int j = 0; j < wave[i].count; j++)
            {
                SpawnAttackerType(wave[i].type);
                float delay = wave[i].delay > 0 ? wave[i].delay : 1f / wave[i].rate;
                yield return(new WaitForSeconds(delay));
            }
        }
        //waveIndex++;
    }
Exemple #3
0
 private void Awake()
 {
     if (instance != null)
     {
         Debug.Log("More than one GameToast in scene!");
         return;
     }
     instance = this;
 }
    public void AddToast(GameToast toast)
    {
        toast.transform.parent        = BnetBar.Get().m_questProgressToastBone.transform;
        toast.transform.localRotation = Quaternion.Euler(new Vector3(90f, 180f, 0f));
        toast.transform.localScale    = new Vector3(450f, 1f, 450f);
        toast.transform.localPosition = Vector3.zero;
        this.m_toasts.Add(toast);
        RenderUtils.SetAlpha(toast.gameObject, 0f);
        this.UpdateToastPositions();
        object[]  args      = new object[] { "amount", 1f, "time", 0.25f, "delay", 0.25f, "easeType", iTween.EaseType.easeInCubic, "oncomplete", "FadeOutToast", "oncompletetarget", base.gameObject, "oncompleteparams", toast };
        Hashtable hashtable = iTween.Hash(args);

        iTween.FadeTo(toast.gameObject, hashtable);
    }
Exemple #5
0
    public void RepairTurret()
    {
        if (turret == null)
        {
            return;
        }
        int cost = RepairCost();

        if (BattleManager.instance.stats.Money < cost)
        {
            GameToast.Add("Not enough money to repair that!");
            return;
        }
        Turret t = turret.GetComponent <Turret>();

        t.health = t.startHealth;
        BattleManager.instance.stats.Money -= cost;
        RepairCooldown = Time.time + 5f;
    }
Exemple #6
0
    public void SellTurret()
    {
        if (turret == null)
        {
            return;
        }
        BattleManager.instance.stats.Money += turretBlueprint.GetSellAmount();
        GameObject effects = GameObject.Find("Effects");

        if (!effects)
        {
            effects = new GameObject("Effects");
        }
        GameObject effect = Instantiate(buildManager.sellEffect, GetBuildPosition(), Quaternion.identity, effects.transform);

        Destroy(effect, 5f);
        Destroy(turret);
        turretBlueprint = null;
        GameToast.Add("Turret sold!");
    }
Exemple #7
0
    public void BuildTurret(TurretBlueprint blueprint)
    {
        if (BattleManager.instance.stats.Money < blueprint.cost)
        {
            GameToast.Add("Not enough money to build that!");
            return;
        }
        BattleManager.instance.stats.Money -= blueprint.cost;
        GameObject _turret = Instantiate(blueprint.prefab, GetBuildPosition(), Quaternion.identity);

        Turret t = _turret.GetComponent <Turret>();

        t.node = gameObject;

        turret          = _turret;
        turretBlueprint = blueprint;
        GameObject effects = GameObject.Find("Effects");

        if (!effects)
        {
            effects = new GameObject("Effects");
        }
        if (!buildManager)
        {
            //Debug.Log("buildmanager is null");
            buildManager = BGBuildManager.instance;
        }
        if (!buildManager)
        {
            Debug.Log("buildmanager is still null");
        }
        GameObject effect = Instantiate(buildManager.buildEffect, GetBuildPosition(), Quaternion.identity, effects.transform);

        Destroy(effect, 5f);
        GameToast.Add("Turret Built!");
        isUpgraded = false;
    }
Exemple #8
0
    public void UpgradeTurret()
    {
        if (turret == null)
        {
            return;
        }
        if (BattleManager.instance.stats.Money < turretBlueprint.upgradeCost)
        {
            GameToast.Add("Not enough money to upgrade that!");
            return;
        }
        BattleManager.instance.stats.Money -= turretBlueprint.upgradeCost;
        Vector3 oldrotation = new Vector3(turret.transform.eulerAngles.x, turret.transform.eulerAngles.x, turret.transform.eulerAngles.z);

        Destroy(turret);
        GameObject _turret = Instantiate(turretBlueprint.upgradedPrefab, GetBuildPosition(), Quaternion.identity);

        turret = _turret;

        Turret t = _turret.GetComponent <Turret>();

        t.node = gameObject;

        turret.transform.eulerAngles = oldrotation;
        GameObject effects = GameObject.Find("Effects");

        if (!effects)
        {
            effects = new GameObject("Effects");
        }
        GameObject effect = Instantiate(buildManager.buildEffect, GetBuildPosition(), Quaternion.identity, effects.transform);

        Destroy(effect, 5f);
        isUpgraded = true;
        GameToast.Add("Turret upgraded!");
    }
 private void DeactivateToast(GameToast toast)
 {
     toast.gameObject.SetActive(false);
     this.m_toasts.Remove(toast);
     this.UpdateToastPositions();
 }