// Update is called once per frame
 void Update()
 {
     if (stats == null)
     {
         stats = GameObject.Find("PlayerStatsBehaviour").GetComponent <PlayerSatsBehaviour>();
     }
     else
     {
         if (!CashText.text.Equals(stats.Cash.ToString("#00.00")))
         {
             CashText.text = stats.Cash.ToString("#00.00");
         }
         switch (GemsText.text)
         {
         case string A when GemsText.text != stats.Gems.ToString():
             GemsText.text = stats.Gems.ToString("#00");
             break;
         }
         switch (PlayerLevelText.text)
         {
         case string A when PlayerLevelText.text != stats.PlayerLevel.ToString():
             PlayerLevelText.text = stats.PlayerLevel.ToString("#00");
             break;
         }
     }
 }
 void Awake()
 {
     if (_stats == null)
     {
         _stats = GameObject.Find("PlayerStatsBehaviour").GetComponent <PlayerSatsBehaviour>();
     }
 }
示例#3
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.tag == "Ground")
     {
         Debug.Log("Ground");
         SceneManager.LoadScene(2);
     }
     if (other.gameObject.tag == "Tree")
     {
         Debug.Log("Tree");
         SceneManager.LoadScene(2);
     }
     if (other.gameObject.tag == "Collectable")
     {
         Debug.Log("Collectable");
         PlayerSatsBehaviour stats = GameObject.Find("PlayerStatsBehaviour").GetComponent <PlayerSatsBehaviour>();
         stats.Cash += 10f;
         Destroy(other.gameObject);
     }
     if (other.gameObject.tag == "Enemy")
     {
         Debug.Log("EnemyTouched");
         SceneManager.LoadScene(2);
     }
 }
 void Awake()
 {
     switch (CashText)
     {
     case Text A when CashText == null:
         CashText = GameObject.Find("TotalMoneyText").GetComponent <Text>();
         break;
     }
     switch (GemsText)
     {
     case Text A when GemsText == null:
         CashText = GameObject.Find("TotalGemsText").GetComponent <Text>();
         break;
     }
     switch (PlayerLevelText)
     {
     case Text A when PlayerLevelText == null:
         CashText = GameObject.Find("TotalLevelText").GetComponent <Text>();
         break;
     }
     switch (stats)
     {
     case PlayerSatsBehaviour a when stats == null:
         stats = GetComponent <PlayerSatsBehaviour>();
         break;
     }
 }
示例#5
0
 void Start()
 {
     stats = GameObject.Find("PlayerStatsBehaviour").GetComponent <PlayerSatsBehaviour>();
     if (stats != null)
     {
         stats.PlayerLevel             = PlayerLevel;
         stats.Points                  = Points;
         stats.Experience              = Experience;
         stats.Cash                    = Cash;
         stats.Gems                    = Gems;
         stats.SpeedLevel              = SpeedLevel;
         stats.DamageLevel             = DamageLevel;
         stats.HealthLevel             = HealthLevel;
         stats.AttackSpeedLevel        = AttackSpeedLevel;
         stats.IncreaseCoinIncomeLevel = IncreaseCoinIncomeLevel;
         stats.ChanceOfIceBulletLevel  = ChanceOfIceBulletLevel;
         stats.MultiShotLevel          = MultiShotLevel;
         stats.InvincibilityLevel      = InvincibilityLevel;
         stats.SecondLifeChanceLevel   = SecondLifeChanceLevel;
         stats.Bird2Bought             = Bird2Bought;
         stats.Bird3Bought             = Bird3Bought;
         stats.Bird4Bought             = Bird4Bought;
         stats.HighScore               = HighScore;
     }
 }
示例#6
0
 void Awake()
 {
     if (stats == null)
     {
         stats = GameObject.Find("PlayerStatsBehaviour").GetComponent <PlayerSatsBehaviour>();
     }
     AssignShopCosts();
 }
示例#7
0
 // Update is called once per frame
 void FixedUpdate()
 {
     if (Health <= 50.00f)
     {
         SpriteRenderer rend = this.gameObject.GetComponent <SpriteRenderer>();
         rend.sprite = DamagedEnemy;
     }
     if (Health <= 0.00f)
     {
         PlayerSatsBehaviour stats = GameObject.Find("PlayerStatsBehaviour").GetComponent <PlayerSatsBehaviour>();
         stats.Points += 10;
         Destroy(this.gameObject);
     }
 }
 void Awake()
 {
     if (_shop == null)
     {
         _shop = GameObject.Find("PlayerStatsBehaviour").GetComponent <PlayerSatsBehaviour>();
     }
     if (_shop.SpeedLevel == 1)
     {
         JumpHeight = 3;
     }
     if (_shop.SpeedLevel > 26)
     {
         JumpHeight += _shop.SpeedLevel;
     }
 }
示例#9
0
    // Update is called once per frame
    void FixedUpdate()
    {
        Vector2 Move = new Vector2(transform.position.x, target.position.y);

        transform.position = Vector2.MoveTowards(transform.position, Move, Speed * Time.deltaTime);
        if (Health <= 50.00f)
        {
            SpriteRenderer rend = this.gameObject.GetComponent <SpriteRenderer>();
            rend.sprite = DamagedEnemy;
        }
        if (Health <= 0.00f)
        {
            PlayerSatsBehaviour stats = GameObject.Find("PlayerStatsBehaviour").GetComponent <PlayerSatsBehaviour>();
            stats.Points += 10;
            Destroy(this.gameObject);
        }
    }