Beispiel #1
0
 protected override void SetStartSkills()
 {/*
   *                         if (PlayerPrefs.HasKey("CrowHP"))
   *                                         _HP = PlayerPrefs.GetInt("CrowHP");
   *
   *                         if (PlayerPrefs.HasKey("CrowAttack"))
   *                                         _attack = PlayerPrefs.GetInt("CrowAttack");
   *
   *                         if (PlayerPrefs.HasKey("CrowSpeed"))
   *                         {
   *                                         var unit = GetComponent<Unit>();
   *                                         unit.SetSpeed(PlayerPrefs.GetInt("CrowSpeed"));
   *                         }
   *
   * int playerLVL = Hero.instance.Manager._Level;
   *
   * float timeGame = GameObject.FindGameObjectWithTag("ScriptManager").GetComponent<TimeManager>()._mainTime;
   * int complexity = GameObject.FindGameObjectWithTag("ScriptManager").GetComponent<GemerationLevel>()._Сomplexity;
   *
   * int delta = (int)Math.Truncate((complexity * 10) + (10 * timeGame) + (playerLVL / 2));
   * _attack += delta;
   * _HP += (int)Math.Truncate(delta * 1.5f);
   */
     _controller = GetComponent <CrowController>();
 }
Beispiel #2
0
 public static void HealthCollision(GameObject obj, int health)
 {
     if (obj.GetComponent <CrowController>() != null)
     {
         CrowController cont = obj.GetComponent <CrowController>();
         cont.ChangeHealth(health);
     }
 }
Beispiel #3
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        MainSceneManager mainSceneManager = MainSceneManager.getMainSceneManager();
        AudioSource      audioSource      = GetComponent <AudioSource>();

        if (collision.gameObject.tag.Equals("chest"))
        {
            overlappingAttackableObject = collision.gameObject;
        }
        else if (collision.gameObject.CompareTag("RoboSnakeCrushDetector"))
        {
            RoboSnakeController roboSnakeController =
                collision.gameObject.transform.GetComponentInParent <RoboSnakeController>();
            roboSnakeController.die();
            mainSceneManager.addCurrentScore(roboSnakeController.points);
            audioSource.Play();
            bounce();
        }
        else if (collision.gameObject.CompareTag("AligatorCrushDetector"))
        {
            AligatorController aligatorController =
                collision.gameObject.transform.GetComponentInParent <AligatorController>();
            aligatorController.die();
            mainSceneManager.addCurrentScore(aligatorController.points);
            audioSource.Play();
            bounce();
        }
        else if (collision.gameObject.CompareTag("CrowCrushDetector"))
        {
            CrowController crowController =
                collision.gameObject.transform.GetComponentInParent <CrowController>();
            crowController.die();
            mainSceneManager.addCurrentScore(crowController.points);
            audioSource.Play();
            bounce();
        }
    }