コード例 #1
0
 void Start()
 {
     animator          = GetComponent <Animator>();
     headAnimator      = GameObject.FindWithTag("Head").GetComponent <Animator>();
     zombiemanAnimator = GameObject.FindWithTag("Zombieman").GetComponent <Animator>();
     fireAnimator      = GameObject.FindWithTag("Fire").GetComponent <Animator>();
     ammoPoints        = GetComponent <PlayerPointSystem>();
     fragPoints        = GetComponent <PlayerPointSystem>();
 }
コード例 #2
0
    public void TakeDamage(GameObject gameObject)
    {
        Animator animator = gameObject.GetComponent <Animator>();
        int      damage   = 10;

        health = Max(health - damage, 0);
        animator.SetInteger("Health", health);
        animator.SetTrigger("TookDamage");

        if (gameObject.tag == "Head")
        {
            healthPoints = GetComponent <PlayerPointSystem>();
            healthPoints.UpdatePoints(health);
        }
    }