Ejemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        timer  = 0;
        anim   = transform.GetComponent <Animator>();
        bullet = Bullets[0];
        Plane.SetActive(false);
        Particel.SetActive(false);
        Projector.SetActive(false);
        ShotParticel.SetActive(false);

        OnShotSpecial = false;
    }
Ejemplo n.º 2
0
    void Update()
    {
        if (shoot == true)
        {
            timer += Time.deltaTime;
            if (timer > 0.5f)
            {
                GameObject go = Instantiate(bullet);
                go.transform.position = SpawnPoint.position;
                Rigidbody rb = go.transform.GetComponent <Rigidbody>();
                rb.AddForce(transform.forward * 10f, ForceMode.Impulse);
                shoot = false;
                timer = 0;
            }
        }

        if (specialShoot == true)
        {
            Projector.SetActive(true);
            Particel.SetActive(true);
            Plane.SetActive(true);

            timer += Time.deltaTime;
            if (timer > 2.9f)
            {
                //Effect
                specialShoot = false;
                timer        = 0;
                Projector.SetActive(false);
                Particel.SetActive(false);
                Plane.SetActive(false);
                ShotParticel.SetActive(false);
                OnShotSpecial = false;
            }
            else if (timer > 2.4f)
            {
                if (OnShotSpecial == false)
                {
                    OnShotSpecial = true;
                    ShotParticel.SetActive(true);
                    //SHoot
                    GameObject go = Instantiate(SpecialBullet);
                    go.transform.position = SpawnPoint.position;
                    Rigidbody rb = go.transform.GetComponent <Rigidbody>();
                    rb.AddForce(transform.forward * 10f, ForceMode.Impulse);
                }
                ShotParticel.transform.rotation = SpawnPoint.rotation;
            }
        }
    }