// Start is called before the first frame update
    void Start()
    {
        rb             = GetComponent <Rigidbody2D>();
        switchState    = GetComponent <SwitchState>();
        healthBar      = GameObject.Find("PlayerHealthBar").GetComponent <HealthBar>();
        healthToEnrage = (int)Math.Ceiling((double)health / 2);
        healthBar.SetMaxSlider(health); //we set the slider's max value to the max value of player's health
        knightAttack = GameObject.Find("Knight").GetComponent <KnightAttack>();

        hitSound   = GameObject.Find("HitSound").GetComponent <AudioSource>();
        healSound  = GameObject.Find("HealSound").GetComponent <AudioSource>();
        deathSound = GameObject.Find("DeathSound").GetComponent <AudioSource>();
    }
示例#2
0
文件: Knight.cs 项目: wlsdud5938/BTD
 // Start is called before the first frame update
 protected void Start()
 {
     preLocation   = transform.position;
     enemyAnimator = GetComponent <Animator>();
     knightAttack  = transform.GetChild(0).GetComponent <KnightAttack>();
 }
示例#3
0
 // Update is called once per frame
 public void Start()
 {
     sm     = GameObject.FindGameObjectWithTag("Sound").GetComponent <SoundManager>();
     knight = GameObject.FindGameObjectWithTag("Player").GetComponent <KnightAttack>();
     manaUi = GameObject.Find("ManaUI").GetComponent <ManaUI>();
 }