Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (svg.mulai)
        {
            if (Time.time >= timestamp)
            {
                egunbullet newbullet = Instantiate(peluru, asalpeluru.position, asalpeluru.rotation) as egunbullet;
                newbullet.speed = bulletspeed;
                timestamp       = Time.time + timebetweenshots * 0.5f;
            }
        }

        mytransform.rotation = Quaternion.Slerp(mytransform.rotation, Quaternion.LookRotation(target.position - mytransform.position), rotationspeed * Time.deltaTime);
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (canact)
        {
            if (playerinrange && Time.time >= timestamp)
            {
                egunbullet newbullet = Instantiate(peluru, asalpeluru.position, asalpeluru.rotation) as egunbullet;
                newbullet.speed = bulletspeed;
                timestamp       = Time.time + timebetweenshots * 0.5f;
            }

            if (!playerinrange)
            {
                if (spotp.chaseplayer)
                {
                    mytransform.position += mytransform.forward * movespeed * Time.deltaTime;
                }
            }
            mytransform.rotation = Quaternion.Slerp(mytransform.rotation, Quaternion.LookRotation(target.position - mytransform.position), rotationspeed * Time.deltaTime);
        }

        //	if (fillamount != content.fillAmount) {
        //		content.fillAmount = Mathf.Lerp(content.fillAmount,fillamount,Time.deltaTime*lerpspeed);
        //		secondcontent.fillAmount = Mathf.Lerp(secondcontent.fillAmount,fillamount,Time.deltaTime*secondlerpspeed);
        //	}

        //if(Input.GetMouseButtonDown(0)){
        //	ehealth.ECurvalue -= peplayer.attack;
        //damagekontrol.damage.text = "" + peplayer.attack;
        //damagecontrol newdamage = Instantiate(damagekontrol, asaldamage.position, asaldamage.rotation) as damagecontrol;
        //}

        if (ehealth.ECurvalue <= 0)
        {
            this.GetComponent <CharacterController> ().enabled = false;
            model.SetActive(false);
            canact = false;
            meletus.SetActive(true);
            meletustime += Time.deltaTime;
            if (meletustime >= 3)
            {
                Destroy(this.gameObject);
            }
        }

        mytransform.rotation = Quaternion.Slerp(mytransform.rotation, Quaternion.LookRotation(target.position - mytransform.position), rotationspeed * Time.deltaTime);
    }