示例#1
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (castle == null)
        {
            //Destroy(gameObject);
            return;
        }

        agent.SetDestination(castle.transform.position);

        if (Vector3.Distance(transform.position, castle.transform.position) < 1.2f)
        {
            goblin.KillHPBar();
            Debug.Log("I hit you!");
            castle.TakeDamage(1);

            pool.DeactivateObject(gameObject);
            goblin.SetAlive(false);
        }
    }