Exemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        PLAYER    = GameObject.FindGameObjectWithTag("Player");
        getattack = GameObject.FindGameObjectWithTag("Player").GetComponent <Attacking>();
        NavMesh   = GetComponent <NavMeshAgent>();
        Rb        = GetComponent <Rigidbody>();

        // Rb.velocity = Vector3.zero;
        NavMesh.isStopped = true;
        NavMesh.speed     = 8;
        NavMesh.SetDestination(RandoPos());
        //anim = GetComponent<Animator>();
        getcom = GameObject.FindGameObjectWithTag("S").GetComponent <Combat_Slime>();
    }
    private void SpawnAndScale(Vector3 pos)
    {
        Debug.Log("spawning enemy");
        GameObject spawn1 = Instantiate(squirm, pos, transform.rotation);

        spawn1.transform.localScale -= spawn1.transform.localScale / 2;
        Combat_Slime script = spawn1.GetComponent <Combat_Slime>();

        spawn1.GetComponent <enemyController>().hitBack = 0;
        script.FormsLeft -= 1;

        if (script.FormsLeft == 1)
        {
            script.health = maxhealth - 1;
        }
        else if (script.FormsLeft == 0)
        {
            script.health = maxhealth - 2;
        }
        Debug.Log(script.health);
    }