Exemple #1
0
    /// <summary>
    /// Displays when player earns a reward.
    /// Tells them what they earned and why.
    /// Authors: Steven Johnson, Courtney Chu
    /// </summary>
    public static IEnumerator DisplayRewardsPanel()
    {
        if (didUpgradeFirstTower && notYetReceivedFirstTowerUpgradeReward)
        {
            rewardsPanelText.text = "You Upgraded your first tower! Nice!";
            rewardsPanel.SetActive(true);
            GameManager.notYetReceivedFirstTowerUpgradeReward = false;
            AddMoney(20);
        }
        else if (didPlaceBulletTower && didPlaceShotgunTower && didPlaceBlackHoleTower && didPlaceLaserTower && didPlaceFlameTower && notYetReceivedTowerPlacementReward)
        {
            rewardsPanelText.text = "You placed one of every tower type! Nice!";
            rewardsPanel.SetActive(true);
            GameManager.notYetReceivedTowerPlacementReward = false;
            AddMoney(50);
        }
        else if (didUpgradeBulletTower && didUpgradeShotgunTower && didUpgradeBlackHoleTower && didUpgradeLaserTower && didUpgradeFlameTower && notYetReceivedTowerUpgradeReward)
        {
            rewardsPanelText.text = "You upgraded one of every tower type! Nice!";
            rewardsPanel.SetActive(true);
            GameManager.notYetReceivedTowerUpgradeReward = false;
            CastleManager.AddCastleHealth();
        }

        yield return(new WaitForSeconds(6));

        rewardsPanel.SetActive(false);
    }
 /// <summary>
 /// If eligible, adds 100 to the castle health, takes appropriate amount of money
 /// </summary>
 public void UpgradeCastleHealth()
 {
     if (upgradeHealthCost <= GameManager.money)
     {
         GameManager.AddMoney(-upgradeHealthCost);
         CastleManager.AddCastleHealth();
     }
 }
Exemple #3
0
 // Use this for initialization
 void Start()
 {
     defenderParent = GameObject.Find("Defenders");
     castleManager  = GameObject.FindObjectOfType <CastleManager> ();
     if (defenderParent == null)
     {
         defenderParent = new GameObject("Defenders");
     }
     timer = 0;
 }
Exemple #4
0
    /// <summary>
    /// Take damage, remove entered gameobject from list of active enemies and then destroy gameobject.
    ///
    /// Author: Amy Lewis
    /// Edited by Courtney Chu
    /// </summary>
    /// <param name="other">The other Collider2D involved in this collision.</param>
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "Enemy")
        {
            CastleManager.TakeDamage(1);

            ParticleSystem explosionParticle = Instantiate(explosionPrefab, other.transform.position, transform.rotation);
            explosionParticle.transform.SetParent(explosionParent);

            deathSound.PlayOneShot(deathSound.clip);

            EnemyManager.RemoveEnemy(other.gameObject.GetComponent <Enemy>());
            Destroy(explosionParticle.gameObject, explosionParticle.main.duration);
            Destroy(other.gameObject);
        }
        else if (other.tag == "Walrusu")
        {
            CastleManager.TakeDamage(10);

            ParticleSystem explosionParticle = Instantiate(explosionPrefab, other.transform.position, transform.rotation);
            explosionParticle.transform.SetParent(explosionParent);

            deathSound.PlayOneShot(deathSound.clip);

            EnemyManager.RemoveEnemy(other.gameObject.GetComponent <Enemy>());
            Destroy(explosionParticle.gameObject, explosionParticle.main.duration);
            Destroy(other.gameObject);
        }
        else if (other.tag == "Boss")
        {
            CastleManager.TakeDamage(25);

            ParticleSystem explosionParticle = Instantiate(explosionPrefab, other.transform.position, transform.rotation);
            explosionParticle.transform.SetParent(explosionParent);

            deathSound.PlayOneShot(deathSound.clip);

            EnemyManager.RemoveEnemy(other.gameObject.GetComponent <Enemy>());
            Destroy(explosionParticle.gameObject, explosionParticle.main.duration);
            Destroy(other.gameObject);
        }
    }
Exemple #5
0
 // Update is called once per frame
 void Update()
 {
     CastleManager.CastleUpdate();
     if (state == GameState.IDLE)
     {
         gameUI.alpha  = Mathf.Lerp(gameUI.alpha, 1, Time.deltaTime * 10);
         initMap.alpha = Mathf.Lerp(initMap.alpha, 0, Time.deltaTime * 10);
     }
     if (Input.GetKeyDown("`"))
     {
         if (mode == GameMode.EDITOR)
         {
             mode = GameMode.GAME;
         }
         else
         {
             mode = GameMode.EDITOR;
         }
         unitDisplay.SetMode();
     }
 }
Exemple #6
0
    private void Awake()
    {
        if (!instance)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        lootPileRenderers = new List <GameObject>();
        lootPile          = new List <Item>();
        for (int i = 0; i < maxLootPileSize; i++)
        {
            GameObject spriteHolder = new GameObject();
            spriteHolder.AddComponent <SpriteRenderer>();
            spriteHolder.transform.parent   = lootPilePosition;
            spriteHolder.transform.position = lootPilePosition.position;
            lootPileRenderers.Add(spriteHolder);
        }
    }
Exemple #7
0
 // Use this for initialization
 void Start()
 {
     castleManager = GameObject.FindObjectOfType <CastleManager> ();
 }
Exemple #8
0
        public override void TalkedReply(L2Player talker, int ask, int reply)
        {
            if (ask == -1000)
            {
                if (reply == 0)
                {
                    talker.ShowHtm(GetDialog("fnHi"), myself);
                }
                else if (reply == 1)
                {
                    NpcHtmlMessage htm = new NpcHtmlMessage(talker, GetDialog(myself.residenceId > 0 ? "fnFeudInfo" : "fnNoFeudInfo"), myself.ObjID);

                    if (myself.residenceId > 0)
                    {
                        Castle castle = CastleManager.getInstance().get(myself.residenceId);
                        htm.replace("<?my_pledge_name?>", castle.OwningClanName);
                        htm.replace("<?my_owner_name?>", castle.OwningPlayerName);
                        htm.replace("<?current_tax_rate?>", (int)castle.Tax);
                    }

                    htm.replace("<?kingdom_name?>", FString.getInstance().get(myself.residenceId < 7 ? 1001000 : 1001100));
                    htm.replace("<?feud_name?>", FString.getInstance().get(myself.residenceId + 1001000));

                    talker.sendPacket(htm);
                }
            }
            else if (ask == -303)
            {
                if (reply == 579)
                {
                    if (talker.Level > 40 && talker.Level < 46)
                    {
                        MultiSell.getInstance().showList(talker, myself, reply);
                    }
                }
                else if (reply == 580)
                {
                    if (talker.Level >= 46 && talker.Level < 52)
                    {
                        MultiSell.getInstance().showList(talker, myself, reply);
                    }
                }
                else if (reply == 581)
                {
                    if (talker.Level >= 52)
                    {
                        MultiSell.getInstance().showList(talker, myself, reply);
                    }
                }
                else
                {
                    MultiSell.getInstance().showList(talker, myself, reply);
                }
            }
            else if (ask == -503)
            {
                if (reply == 100)
                {
                    ShowVariationMakeWindow(talker);
                }
                else if (reply == 200)
                {
                    ShowVariationCancelWindow(talker);
                }
            }
            else if (ask == -601)
            {
                if (reply == 0)
                {
                    if (!talker.hasAllOfThisItems(8957, 8958, 8959))
                    {
                        talker.ShowHtm("welcomeback003.htm", myself);
                    }
                    else
                    {
                        talker.ShowHtm("welcomeback004.htm", myself);
                    }
                }
                else if (reply == 0)
                {
                    if (!talker.hasAllOfThisItems(8957, 8958, 8959))
                    {
                        talker.ShowHtm("welcome_lin2_cat002.htm", myself);
                    }
                    else
                    {
                        talker.ShowHtm("welcome_lin2_cat004.htm", myself);
                    }
                }
                else if (reply == 2)
                {
                    if (talker.Level < 20)
                    {
                        MultiSell.getInstance().showList(talker, myself, 583);
                    }
                    else if (talker.Level >= 20 && talker.Level < 40)
                    {
                        MultiSell.getInstance().showList(talker, myself, 584);
                    }
                    else if (talker.Level >= 40 && talker.Level < 52)
                    {
                        MultiSell.getInstance().showList(talker, myself, 585);
                    }
                    else if (talker.Level >= 52 && talker.Level < 61)
                    {
                        MultiSell.getInstance().showList(talker, myself, 586);
                    }
                    else if (talker.Level >= 61 && talker.Level < 76)
                    {
                        MultiSell.getInstance().showList(talker, myself, 587);
                    }
                    else if (talker.Level >= 76)
                    {
                        MultiSell.getInstance().showList(talker, myself, 588);
                    }
                }
                else if (reply == 3)
                {
                    if (talker.Level < 20)
                    {
                        MultiSell.getInstance().showList(talker, myself, 589);
                    }
                    else if (talker.Level >= 20 && talker.Level < 40)
                    {
                        MultiSell.getInstance().showList(talker, myself, 590);
                    }
                    else if (talker.Level >= 40 && talker.Level < 52)
                    {
                        MultiSell.getInstance().showList(talker, myself, 591);
                    }
                    else if (talker.Level >= 52 && talker.Level < 61)
                    {
                        MultiSell.getInstance().showList(talker, myself, 592);
                    }
                    else if (talker.Level >= 61 && talker.Level < 76)
                    {
                        MultiSell.getInstance().showList(talker, myself, 593);
                    }
                    else if (talker.Level >= 76)
                    {
                        MultiSell.getInstance().showList(talker, myself, 594);
                    }
                }
                else if (reply == 4)
                {
                    if (talker.Level < 20)
                    {
                        MultiSell.getInstance().showList(talker, myself, 595);
                    }
                    else if (talker.Level >= 20 && talker.Level < 40)
                    {
                        MultiSell.getInstance().showList(talker, myself, 596);
                    }
                    else if (talker.Level >= 40 && talker.Level < 52)
                    {
                        MultiSell.getInstance().showList(talker, myself, 597);
                    }
                    else if (talker.Level >= 52 && talker.Level < 61)
                    {
                        MultiSell.getInstance().showList(talker, myself, 598);
                    }
                    else if (talker.Level >= 61 && talker.Level < 76)
                    {
                        MultiSell.getInstance().showList(talker, myself, 601);
                    }
                    else if (talker.Level >= 76)
                    {
                        MultiSell.getInstance().showList(talker, myself, 600);
                    }
                }
            }
        }