Beispiel #1
0
 public void UIStart()
 {
     upgradeList          = new UpgradeList(name, displayName);
     upgradeUIObject      = upgradeList.Start();
     panel                = upgradeUIObject.GetComponent <PanelController>();
     panel.ButtonClicker += Add;
 }
    public bool activeShield;//irrelevant code does not do anything. its implamented in about ten different scripts, if removed it will cause a cascade of errors.

    void Start()
    {
        active             = false;
        activeShield       = false;
        rb                 = GetComponent <Rigidbody>();
        currentSpeed       = walkSpeed;
        playerStats        = GetComponent <PlayerStats>();
        upgradeList        = GetComponent <UpgradeList>();
        hologramController = GameObject.Find("HologramTarget").GetComponent <HologramController>();
    }
Beispiel #3
0
 public void SetUpgradeData(StardustCounter pStardustCounter, UpgradeList upgradeList, UpgradeObject pNewUpgradeData)
 {
     mStardustCounter = pStardustCounter;
     mUpgradeList     = upgradeList;
     upgradeData      = pNewUpgradeData;
     icon.sprite      = upgradeData.icon;
     SetTexts();
     SetLevel();
     SetCost();
     SetButton();
 }
Beispiel #4
0
// Use this for initialization
    void Start()
    {
        HPvar.GetComponent <FollowPlayer>().Player = this.gameObject;
        HPvar              = Instantiate(HPvar);
        upgradeList        = new UpgradeList(FileLoader.Load());
        movement           = GetComponent <Movement>();
        MoveSpeed          = movement.MoveSpeed + 0.2f * upgradeList.Speed;
        movement.MoveSpeed = MoveSpeed;
        HP     += 5 * upgradeList.HP;
        Damage += 0.5f * upgradeList.Damage;
    }
Beispiel #5
0
    void Start()
    {
        PauseList = GameObject.Find("PauseList").gameObject;

        IsGamePaused = false;
        IsGameEnd    = false;
        Text_Money   = GameObject.Find("Money").GetComponent <Text>();
        InvokeRepeating("MakeMoney", 0f, 0.5f);
        upgradeList = new UpgradeList(new FileLoader().Load());
        units       = new List <GameObject>();
        towers      = new List <GameObject>();
    }
Beispiel #6
0
    public SaveData(UpgradeList upgrade)
    {
        Duration       = upgrade.Duration;
        IncreaseEffect = upgrade.IncreaseEffect;

        Speed  = upgrade.Speed;
        HP     = upgrade.HP;
        Damage = upgrade.Damage;

        GetSpeed = upgrade.GetSpeed;
        MaxMoney = upgrade.Max;

        UpgradeCount = upgrade.UpgradeCount;
    }
Beispiel #7
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "Shield")
        {
            int a = Random.Range(0, 6);

            int T = new UpgradeList(FileLoader.Load()).IncreaseEffect;

            if (a <= T)
            {
                Destroy(gameObject);
            }
        }
    }
Beispiel #8
0
    /// <summary>
    ///
    /// Removes an upgrade from the deck
    ///
    /// </summary>
    public void RemoveUpgrade(UpgradeData upgradeData)
    {
        if (UpgradeIdList.Contains(upgradeData.Id.Value))
        {
            UpgradeList.Remove(upgradeData);
            UpgradeIdList.Remove(upgradeData.Id.Value);

            if (upgradeData.UpgradeTag == UpgradeTags.DeathDefiant)
            {
                DeathDefiant = false;
            }
        }
        else
        {
            throw new Exception($"Upgrade {upgradeData.Id} does not exist in the deck");
        }
    }
Beispiel #9
0
    private void LoadInPermUpgrades()
    {
        _upgrades = new List <Upgrade>();

        // the Upgrade List scriptable object must be in a Resources folder inside your project, like so : Resources/Upgrades/PermUpgrades/PUT_SCRIPTABLE_OBJECT_HERE
        upgradeList = (UpgradeList)Resources.Load("Upgrades/PermUpgrades");
        if (upgradeList == null)
        {
            Debug.LogError("Could not find UpgradeList in 'Resources/Upgrades/PermUpgrades'");
            return;
        }

        foreach (Upgrade upgrade in upgradeList.Upgrades)
        {
            _upgrades.Add(upgrade.Copy());
        }
    }
Beispiel #10
0
    /// <summary>
    ///
    /// Adds an upgrade to the deck
    ///
    /// </summary>
    public void AddUpgrade(UpgradeData upgradeData, bool trackAddition = true)
    {
        UpgradeList.Add(upgradeData);
        UpgradeIdList.Add(upgradeData.Id.Value);
        GameManager.instance.upgradeManager.UpdateUpgradeEffect(upgradeData, this);

        if (IsCampaign)
        {
            if (trackAddition)
            {
                CampaignTracker.HonourPoints -= upgradeData.GetHonourPointsCost(CampaignTracker.CompletedSinceTierUpgrade);
                if (upgradeData.IsTierLevel)
                {
                    CampaignTracker.CompletedSinceTierUpgrade = 0;
                }
            }
        }
    }
Beispiel #11
0
    // Use this for initialization
    void Start()
    {
        /*SaveData saveData = new FileLoader().Load();
         *
         * upgrade.Speed = saveData.Speed;
         * upgrade.HP = saveData.HP;
         * upgrade.Damage = saveData.Damage;
         *
         * upgrade.Duration = saveData.Duration;
         * upgrade.IncreaseEffect = saveData.IncreaseEffect;
         *
         * upgrade.GetSpeed = saveData.GetSpeed;
         * upgrade.Max = saveData.MaxMoney;*/

        upgrade = new UpgradeList(new FileLoader().Load());
        //new SaveData().Save();
        UC = GameObject.Find("UpgradeCount").GetComponent <Text>();
    }
    // Use this for initialization
    void Start()
    {
        GameObject _GM = GameObject.Find("_GM");

        solutions    = _GM.GetComponent <Solutions>();
        buildingList = _GM.GetComponent <BuildingList>();
        upgradeList  = _GM.GetComponent <UpgradeList>();

        sprite = GetComponentInChildren <SpriteRenderer>();

        // Raycast downwards to terrain and assign joint anchor
        RaycastHit2D terrainHit = Physics2D.Raycast(transform.position + Vector3.up * 10, -Vector2.up, float.MaxValue, terrainLayer);

        if (terrainHit.collider != null)
        {
            Vector2 hitPoint    = terrainHit.point;
            string  terrainName = terrainHit.collider.gameObject.name;

            // Try to automatically set soil type based on terrain name

            string[] typeNames = Enum.GetNames(typeof(SoilType));
            Array    typeVals  = Enum.GetValues(typeof(SoilType));
            for (int i = 0; i < typeNames.Length; i++)
            {
                if (terrainName.Equals(typeNames[i]))
                {
                    soilType = (SoilType)typeVals.GetValue(i);
                }
            }

            gameObject.name = gameObject.name + " of " + soilType + " on " + terrainHit.collider.gameObject.name;

            if (!soilType.ToString().Equals(terrainName))
            {
                Debug.Log("WARNING: Soil type property name of building zone do not equal terrain name: " + soilType + " != " + terrainHit.collider.gameObject.name);
            }
        }
        else
        {
            Debug.Log("WARNING: Terrain not found of building platform");
        }
    }
Beispiel #13
0
    /// <summary>
    ///
    /// Function for updating the tier level of the hero card
    ///
    /// </summary>
    public void UpdateHeroCard(TierLevel heroTier, TierLevel abilityTier)
    {
        HeroTier    = heroTier;
        AbilityTier = abilityTier;
        HeroCard    = GameManager.instance.libraryManager.GetHero(DeckClass, heroTier, abilityTier);

        //Add the hero upgrades. Loops between tier 1 and the selected Hero Tier
        for (int tierIndex = (int)TierLevel.Tier1; tierIndex <= (int)heroTier; tierIndex++)
        {
            var heroUpgrade = GameManager.instance.upgradeManager.GetUpgrade(UpgradeTags.HeroUpgrade, (TierLevel)tierIndex);
            UpgradeList.Add(heroUpgrade);
            UpgradeIdList.Add(heroUpgrade.Id.Value);
        }
        //Add the hero ability upgrades. Loops between tier 1 and the selected Hero Tier
        for (int tierIndex = (int)TierLevel.Tier1; tierIndex <= (int)abilityTier; tierIndex++)
        {
            var abilityUpgrade = GameManager.instance.upgradeManager.GetUpgrade(UpgradeTags.AbilityUpgrade, (TierLevel)tierIndex);
            UpgradeList.Add(abilityUpgrade);
            UpgradeIdList.Add(abilityUpgrade.Id.Value);
        }
    }
Beispiel #14
0
    protected virtual void OnCollisionEnter2D(Collision2D collision)
    {
        target = collision.gameObject.GetComponent <PlayerScript>();

        if (!target)
        {
            return;
        }

        if (collision.gameObject.tag == "Shield")
        {
            int a = Random.Range(0, 6);

            int T = new UpgradeList(FileLoader.Load()).IncreaseEffect;

            if (a <= T)
            {
                Destroy(gameObject);
                return;
            }
        }
        target.DealDmg(callme.Damage);
    }
Beispiel #15
0
 // Use this for initialization
 void Start()
 {
     mainGame    = Camera.main.GetComponent <MainGame>();
     upgradeList = new UpgradeList(FileLoader.Load());
 }
Beispiel #16
0
 private void AddUpgrades(UpgradeList list)
 {
     list.Upgrades.ForEach(AddUpgradeToList);
 }
Beispiel #17
0
 // Use this for initialization
 void Start()
 {
     upgradeList = new UpgradeList(new FileLoader().Load());
 }