コード例 #1
0
    void OnTriggerStay(Collider col)
    {
        if (col.transform.tag.Contains("agent"))
        {
            Health         health = col.transform.GetComponent <Health>();
            UtilityBasedAI uba    = col.GetComponent <UtilityBasedAI>();
            Movement       move   = col.GetComponent <Movement>();

            col.GetComponent <DealDamage>().damageFrequnce -= 0.2f;

            move.movementFrequency -= 3f;
            uba.runOnce             = false;

            if (health.health >= 100)
            {
                health.health = 100;
            }
            else
            {
                health.health += healthAmount;
            }

            Destroy(gameObject);
        }
    }
コード例 #2
0
    public override void Actions(string name)
    {
        UtilityBasedAI UBA = GameObject.Find(name).GetComponent <UtilityBasedAI>();

        if (!UBA.runOnce)
        {
            DealDamage dd = GameObject.Find(name).GetComponent <DealDamage>();
            dd.RotateTowardsTarget(GameObject.Find("Player").transform.position);
            dd.ThrowGrenade(name);
        }
    }