Beispiel #1
0
    public void PlayShoot(Transform Target, EventHandler callback)
    {
        if (animator != null)
        {
            animator.SetTrigger("bShooting");
        }

        if (Target != null)
        {
            //MDebug.Log("Play Shoot " +part + " "+Target.name);


            if (fx == null)
            {
                callback();
                //Debug.LogWarning(part + " has no shoot effects");
            }
            else
            {
                ShootEffectsPlaying = true;
                Sequence shooting = fx.Shoot(Target).Play();
                shooting.AppendCallback(() => {
                    //   MDebug.Log("shooting done playing");
                    ShootEffectsPlaying = false;
                    if (callback != null)
                    {
                        callback();
                    }
                });
            }
        }
    }
Beispiel #2
0
 void fireShot()
 {
     if (this.pi.fire && Time.time - this.lastShotTime > this.shotDelay && this.allowShoot)
     {
         sb.Shoot();
         this.lastShotTime = Time.time;
     }
 }
Beispiel #3
0
 void Update()
 {
     if (Time.time - this.lastShotTime > this.shotDelay && this.alive && this.allowShoot)
     {
         shootBullet.Shoot();
         this.lastShotTime = Time.time;
     }
     if (!alive)
     {
         this.transform.Rotate(new Vector3(0, 0, 2));
         //don't need right now, looks alright
         this.transform.localScale = new Vector3(this.transform.localScale.x * 0.99f, this.transform.localScale.y * 0.99f, 1.0f);
     }
 }
Beispiel #4
0
 void Update()
 {
     if (isActive && Time.time - this.activationTime > this.activationOffset)
     {
         if (Time.time - this.lastShotTime > this.shotDelay && this.alive && this.allowShoot)
         {
             sb.Shoot();
             this.lastShotTime = Time.time;
         }
         if (!alive)
         {
             this.transform.Rotate(new Vector3(0, 0, 2));
             //don't need right now, looks alright
             this.transform.localScale = new Vector3(this.transform.localScale.x * 0.99f, this.transform.localScale.y * 0.99f, 1.0f);
         }
         this.enemyCollider.transform.rotation = rb.transform.rotation;
     }
 }
Beispiel #5
0
    //-----------Movement stuff
    void FixedUpdate()
    {
        if (this.pi.moving && this.allowMove)
        {
            //Debug.LogFormat("Fixed update move angle:{0}, moving: {1}, fire: {2}", pi.angle, pi.moving, pi.fire1);
            float x_mult = Mathf.Cos(pi.angle);
            x_mult = (Mathf.Abs(x_mult) > 0.001f) ? x_mult : 0;
            float y_mult = Mathf.Sin(pi.angle);
            y_mult           = (Mathf.Abs(y_mult) > 0.001f) ? y_mult : 0;
            this.rb.velocity = new Vector2(this.maxSpeed * x_mult, this.maxSpeed * y_mult);

            //Oh my god fix this later, driving me insane, keep it simple, stupid

            /*
             * Vector2 target_v = new Vector2(x_mult * this.maxSpeed, y_mult * this.maxSpeed);
             * Vector2 new_v = rb.velocity;
             * int x_dir = ((target_v.x - this.rb.velocity.x) > 1) ? 1 : -1;
             * float new_v_x = new_v.x + x_dir * this.accel;
             * new_v.x = (new_v_x < target_v.x) ? new_v_x : target_v.x;
             * int y_dir = ((target_v.y - this.rb.velocity.y) > 1) ? 1 : -1;
             * float new_v_y = new_v.y + y_dir * this.accel;
             * new_v.y = (new_v_y < target_v.y) ? new_v_y : target_v.y;
             * this.rb.velocity = new_v;
             */
        }
        else             // SLOW DOWN
        {
            this.rb.velocity = new Vector2(0, 0);
        }

        if (this.pi.fire1 && Time.time - this.lastShotTime > this.shotDelay && this.allowShoot)
        {
            sb.Shoot();
            this.lastShotTime = Time.time;
        }
    }
Beispiel #6
0
    void Update()
    {
        if (Input.GetButtonDown("Fire1"))
        {
            //   BulletEmitter.SpawnBullet(Config, gameObject.transform, Target.transform);
            Sequence sq = DG.Tweening.DOTween.Sequence();

            sq.Append(Shoot.Shoot(Target.transform));
        }

        if (Input.GetButtonDown("Fire2"))
        {
            Sequence sq = DOTween.Sequence().Append(d(1))
            ;
            sq.AppendInterval(1);
            sq.AppendCallback(() => { MDebug.Log("1"); });

            sq.AppendCallback(() => { MDebug.Log("1"); });
            sq.Append(d(2));
            sq.Append(d(3));
            sq.AppendCallback(() => { MDebug.Log("1"); });
            //       sq.Play();
        }
    }