Пример #1
0
 void Spell1()
 {
     if (timer == 30)
     {
         makeCircle(24, coinA, offset, .075f, 0, .075f, .075f, 1, false);
         makeCircle(24, coinB, offset2, .075f, 0, .075f, .075f, 1, false);
         offset  += 12;
         offset2 -= 12;
         timer    = 0;
         timer2++;
         playSnd(1);
     }
     if (timer2 == 2)
     {
         float     tempX    = Controller.Instance.player.transform.position.x;
         float     tempY    = Controller.Instance.player.transform.position.y;
         Vector3   rota     = (new Vector3(tempX - this.transform.position.x, tempY - this.transform.position.y, 0));
         float     angle    = GlobalFxns.ToAng(rota);
         EnemyShot targeted = Instantiate(spirit, transform.position, Quaternion.identity);
         targeted.setParameters(1, .05f, 0, .05f, .05f, 1, false);
         targeted.transform.eulerAngles = new Vector3(0, 0, angle + 90);
         Vector3 dir = rota;
         targeted.direction = dir.normalized;
         timer2             = 0;
     }
 }
Пример #2
0
 void AimShot()
 {
     if (shotTimer > shotDelay)
     {
         float     deviation = Random.Range(-variance, variance);
         float     tempX     = Controller.Instance.player.transform.position.x;
         float     tempY     = Controller.Instance.player.transform.position.y;
         Vector3   rota      = (new Vector3(tempX - this.transform.position.x, tempY - this.transform.position.y, 0));
         EnemyShot aimed     = Instantiate(bullet, transform.position, Quaternion.identity);
         bullet.mvtFxn = 2;
         shotTimer     = 0;
         aimed.playerX = tempX;
         aimed.playerY = tempY;
         Vector3 dir = rota;
         if (indirect)
         {
             float ang = GlobalFxns.ToAng(dir.normalized);
             aimed.direction = GlobalFxns.ToVect(ang + deviation);
         }
         else
         {
             aimed.direction = dir.normalized;
         }
         playSnd(1);
     }
 }
Пример #3
0
 //Nonspell 1
 void Nonspell1()
 {
     if (currentStg == 1)
     {
         if (timer == 5)
         {
             playSnd(1);
         }
         if (timer == 10)
         {
             playSnd(1);
         }
         if (timer > 15)
         {
             playSnd(1);
             EnemyShot a = (Instantiate(bulletA, transform.position, Quaternion.Euler(GlobalFxns.ToVect(0 + rotation))) as EnemyShot);
             EnemyShot b = (Instantiate(bulletA, transform.position, Quaternion.Euler(GlobalFxns.ToVect(120 + rotation))) as EnemyShot);
             EnemyShot c = (Instantiate(bulletA, transform.position, Quaternion.Euler(GlobalFxns.ToVect(240 + rotation))) as EnemyShot);
             a.direction             = (GlobalFxns.ToVect(0 + rotation));
             b.direction             = (GlobalFxns.ToVect(120 + rotation));
             c.direction             = (GlobalFxns.ToVect(240 + rotation));
             a.transform.eulerAngles = new Vector3(0, 0, GlobalFxns.ToAng(a.direction) + 90);
             b.transform.eulerAngles = new Vector3(0, 0, GlobalFxns.ToAng(b.direction) + 90);
             c.transform.eulerAngles = new Vector3(0, 0, GlobalFxns.ToAng(c.direction) + 90);
             a.setParameters(1, .05f, 0, .05f, .05f, 1, false);
             b.setParameters(1, .05f, 0, .05f, .05f, 1, false);
             c.setParameters(1, .05f, 0, .05f, .05f, 1, false);
             rotation += 10;
             timer     = 0;
         }
     }
 }
Пример #4
0
 void Spell1()
 {
     if (timer > 100 && !chrgAnim)
     {
         anim.Play("Mokou");
         playSnd(3);
         chrgAnim = !chrgAnim;
     }
     if (timer > 120)
     {
         float     tempX = Controller.Instance.player.transform.position.x;
         float     tempY = Controller.Instance.player.transform.position.y;
         Vector3   rota  = (new Vector3(tempX - this.transform.position.x, tempY - this.transform.position.y, 0));
         float     angle = GlobalFxns.ToAng(rota);
         EnemyShot ph    = Instantiate(phoenix, transform.position, Quaternion.identity) as EnemyShot;
         ph.mvtFxn                = 2;
         ph.velocity              = .05f;
         ph.minvelocity           = .05f;
         ph.maxvelocity           = .05f;
         ph.ticks                 = 20;
         ph.playerX               = tempX;
         ph.playerY               = tempY;
         ph.transform.eulerAngles = new Vector3(0, 0, angle + 90);
         Vector3 dir = rota;
         ph.direction = dir.normalized;
         timer        = 0;
         makeCircle(10, offset, .05f, 0, .05f, .05f, 20, false, 1);
         offset += 5;
         playSnd(1);
         chrgAnim = !chrgAnim;
     }
 }
Пример #5
0
 void Nonspell2()
 {
     if (timer == 60)
     {
         if (timer2 == 0)
         {
             float shotSpd = .05f;
             for (int i = 0; i < 54; i++)
             {
                 EnemyShot coin = Instantiate(coinA, transform.position, Quaternion.identity);
                 coin.direction = GlobalFxns.ToVect(0 + rotation + offset);
                 coin.setParameters(1, shotSpd, 0, shotSpd, shotSpd, 1, false);
                 rotation -= 10;
                 shotSpd  += .003f;
             }
             rotation = 0;
             timer2   = 1;
             timer3++;
         }
         else if (timer2 == 1)
         {
             float shotSpd = .05f;
             for (int i = 0; i < 54; i++)
             {
                 EnemyShot coin = Instantiate(coinB, transform.position, Quaternion.identity);
                 coin.direction = GlobalFxns.ToVect(180 + rotation + offset);
                 coin.setParameters(1, shotSpd, 0, shotSpd, shotSpd, 1, false);
                 rotation += 10;
                 shotSpd  += .003f;
             }
             rotation = 0;
             timer2   = 0;
             timer3++;
         }
         playSnd(2);
     }
     if (timer > 90)
     {
         if (timer3 > 3)
         {
             float streamSpd = .05f;
             float tempX     = Controller.Instance.player.transform.position.x;
             float tempY     = Controller.Instance.player.transform.position.y;
             for (int i = 0; i < 3; i++)
             {
                 Vector3 rota  = (new Vector3(tempX - this.transform.position.x, tempY - this.transform.position.y, 0));
                 float   angle = GlobalFxns.ToAng(rota);
                 makeCircle(20, coinA, angle, streamSpd, 0, streamSpd, streamSpd, 1, false);
                 streamSpd += .005f;
                 playSnd(1);
             }
             timer3 = 0;
         }
         timer = 0;
     }
 }
Пример #6
0
 void curveMove(float angleInc)
 {
     if (moveTimer > 0)
     {
         float currentAng = GlobalFxns.ToAng(direction);
         linearMove(direction, velocity, acceleration, minvelocity, maxvelocity, ticks);
         direction = GlobalFxns.ToVect(currentAng + angleInc);
     }
     else
     {
         mvtFxn = 1;
     }
 }
Пример #7
0
 void Spell2()
 {
     if (timer > 100 && !chrgAnim)
     {
         anim.Play("Mokou");
         chrgAnim = !chrgAnim;
         playSnd(3);
     }
     if (timer > 120)
     {
         for (int i = 0; i < 5 + 1; i++)
         {
             float     tempX  = Controller.Instance.player.transform.position.x;
             float     tempY  = Controller.Instance.player.transform.position.y;
             Vector3   start  = new Vector3(-4 + .8f * i, 16.5f + .4f * i, 0);
             EnemyShot stream = Instantiate(bulletA, start, Quaternion.identity) as EnemyShot;
             Vector3   rota   = (new Vector3(tempX - stream.transform.position.x, tempY - stream.transform.position.y, 0));
             float     angle  = GlobalFxns.ToAng(rota);
             Vector3   dir    = rota;
             stream.direction             = dir.normalized;
             stream.transform.eulerAngles = new Vector3(0, 0, angle + 90);
             stream.setParameters(1, .05f, 0, .05f, .05f, 1, false);
         }
         for (int i = 0; i < 4 + 1; i++)
         {
             float     tempX  = Controller.Instance.player.transform.position.x;
             float     tempY  = Controller.Instance.player.transform.position.y;
             Vector3   start  = new Vector3(-4.5f - .8f * i, 16.9f + .4f * i, 0);
             EnemyShot stream = Instantiate(bulletA, start, Quaternion.identity) as EnemyShot;
             Vector3   rota   = (new Vector3(tempX - stream.transform.position.x, tempY - stream.transform.position.y, 0));
             float     angle  = GlobalFxns.ToAng(rota);
             Vector3   dir    = rota;
             stream.direction             = dir.normalized;
             stream.transform.eulerAngles = new Vector3(0, 0, angle + 90);
             stream.setParameters(1, .05f, 0, .05f, .05f, 1, false);
         }
         timer    = 0;
         chrgAnim = !chrgAnim;
         playSnd(5);
     }
     if (timer2 > 15)
     {
         float     random   = Random.Range(-11f, 3f);
         Vector3   startLoc = new Vector3(random, 19, 0);
         EnemyShot rain     = Instantiate(bulletB, startLoc, Quaternion.identity);
         rain.setParameters(1, .2f, -.0001f, .01f, 0, 1, false);
         rain.direction = new Vector3(0, -.1f, 0);
         timer2         = 0;
         playSnd(4);
     }
 }
Пример #8
0
    void suicideFire()
    {
        float   tempX = Controller.Instance.player.transform.position.x;
        float   tempY = Controller.Instance.player.transform.position.y;
        Vector3 rota  = (new Vector3(tempX - this.transform.position.x, tempY - this.transform.position.y, 0));
        float   angle = GlobalFxns.ToAng(rota);
        float   spdUp = .05f;

        for (int i = 0; i < 5; i++)
        {
            makeCircle(5, angle, spdUp, 0, spdUp, spdUp, 1, false, 0);
            spdUp += .03f;
            shotTimer++;
        }
        playSnd(1);
    }
Пример #9
0
    IEnumerator Attack()
    {
        Vector3 dir = (Player.p.transform.position - transform.position).normalized;
        float   ang = GlobalFxns.ToAng(dir);

        Orientation(ang);
        attacking = true;
        //Play the atk animation
        anim.SetBool("attacking", true);
        HitScan();
        atkcd = 120;
        yield return(new WaitForSeconds(atkdelay));

        attacking = false;
        anim.SetBool("attacking", false);
    }
Пример #10
0
    public void pursue()
    {
        Vector3 pursuitRadius = new Vector2(PlayerControls.pc.transform.position.x - transform.position.x, PlayerControls.pc.transform.position.y - transform.position.y);

        if (pursuitRadius.magnitude < aggroDist)
        {
            pursuitRadius       = pursuitRadius.normalized;
            transform.position += pursuitRadius * mvtSpd * Time.deltaTime;
            float ang = GlobalFxns.ToAng(pursuitRadius);
            Orientation(ang);
            anim.SetBool("moving", true);
        }
        else
        {
            anim.SetBool("moving", false);
        }
    }
Пример #11
0
 void AimShotgun()
 {
     if (shotTimer > shotDelay)
     {
         float     tempX  = Controller.Instance.player.transform.position.x;
         float     tempY  = Controller.Instance.player.transform.position.y;
         Vector3   rota   = (new Vector3(tempX - this.transform.position.x, tempY - this.transform.position.y, 0));
         float     angle  = GlobalFxns.ToAng(rota);
         EnemyShot aimed1 = Instantiate(bulletGroupA, transform.position, Quaternion.identity);
         aimed1.mvtFxn  = 2;
         shotTimer      = 0;
         aimed1.playerX = tempX;
         aimed1.playerY = tempY;
         Vector3 dir = rota;
         aimed1.direction             = dir.normalized;
         aimed1.transform.eulerAngles = new Vector3(0, 0, angle + 90);
         playSnd(1);
     }
 }
Пример #12
0
 void Move()
 {
     if ((transform.position - Player.p.transform.position).magnitude > atkRad)
     {
         if (!attacking)
         {
             anim.SetBool("moving", true);
             Vector3 dir = (Player.p.transform.position - transform.position).normalized;
             float   ang = GlobalFxns.ToAng(dir);
             Orientation(ang);
             transform.position += dir * mvspd;
             //Debug.Log(dir);
         }
         else
         {
             anim.SetBool("moving", false);
         }
     }
 }
Пример #13
0
    void midboss2()
    {
        float tempVel = velocity;

        if (shotTimer > 30)
        {
            for (int i = 0; i < 7; i++)
            {
                EnemyShot thing = Instantiate(bullet, transform.position, Quaternion.identity);
                thing.setParameters(1, tempVel, 0, tempVel, tempVel, 1, false);
                EnemyShot thing2 = Instantiate(bullet, transform.position, Quaternion.identity);
                thing2.setParameters(1, tempVel, 0, tempVel, tempVel, 1, false);
                thing.direction  = GlobalFxns.ToVect(-90 + offsetVal);
                thing2.direction = GlobalFxns.ToVect(-90 + -offsetVal);
                tempVel         += .025f;
            }
            offsetVal += offsetInc;
            shotTimer  = 0;
            timerA++;
            playSnd(1);
        }
        if (timerA > 2)
        {
            float   tempX    = Controller.Instance.player.transform.position.x;
            float   tempY    = Controller.Instance.player.transform.position.y;
            Vector3 rota     = (new Vector3(tempX - this.transform.position.x, tempY - this.transform.position.y, 0));
            float   angle    = GlobalFxns.ToAng(rota);
            float   tempVel2 = .05f;
            for (int i = 0; i < 3; i++)
            {
                EnemyShot aimed = Instantiate(bullet, transform.position, Quaternion.identity);
                aimed.playerX = tempX;
                aimed.playerY = tempY;
                Vector3 dir = rota;
                aimed.direction = dir.normalized;
                aimed.setParameters(2, tempVel2, 0, tempVel2, tempVel2, 1, false);
                tempVel2 += .025f;
            }
            timerA = 0;
            playSnd(1);
        }
    }
Пример #14
0
 void unifiedMvt()
 {
     dirAsFloat = GlobalFxns.ToAng(direction);
     if (dirAsFloat > Controller.Instance.globalAng)
     {
         increment = tempInc;
         direction = GlobalFxns.ToVect(dirAsFloat - increment);
         linearMove(direction, velocity, acceleration, minvelocity, maxvelocity, ticks);
         transform.eulerAngles += new Vector3(0, 0, increment);
     }
     else if (dirAsFloat < Controller.Instance.globalAng)
     {
         increment = tempInc;
         direction = GlobalFxns.ToVect(dirAsFloat + increment);
         linearMove(direction, velocity, acceleration, minvelocity, maxvelocity, ticks);
         transform.eulerAngles += new Vector3(0, 0, -increment);
     }
     else
     {
         increment = 0;
         linearMove(direction, velocity, acceleration, minvelocity, maxvelocity, ticks);
     }
 }
Пример #15
0
    void Move()
    {
        if (!dead && !dashing)
        {
            Vector2 moveVect = Vector2.zero;
            if (Input.GetKey(KeyCode.W))
            {
                moveVect.y += 1;
            }
            if (Input.GetKey(KeyCode.S))
            {
                moveVect.y -= 1;
            }
            if (Input.GetKey(KeyCode.A))
            {
                moveVect.x -= 1;
            }
            if (Input.GetKey(KeyCode.D))
            {
                moveVect.x += 1;
            }
            if (moveVect.magnitude == 0)
            {
                return;
            }

            moveVect.Normalize();
            transform.position += (Vector3)(moveVect * mvspd * 60f * Time.deltaTime);

            float pDir = GlobalFxns.ToAng(moveVect.normalized);
            playerDir = (int)pDir;
            if (playerDir / 45 == 0)
            {
                playerDir   = 2;
                facingRight = true;
                facingBack  = false;
                facingFront = false;
                facingLeft  = false;
            }
            if (playerDir / 45 == 1)
            {
                playerDir = 1;
            }
            if (playerDir / 45 == 2)
            {
                playerDir   = 0;
                facingBack  = true;
                facingRight = false;
                facingLeft  = false;
                facingFront = false;
            }
            if (playerDir / 45 == 3)
            {
                playerDir = 7;
            }
            if (playerDir / 45 == 4)
            {
                playerDir   = 6;
                facingLeft  = true;
                facingFront = false;
                facingBack  = false;
                facingRight = false;
            }
            if (playerDir / 45 == -1)
            {
                playerDir = 3;
            }
            if (playerDir / 45 == -2)
            {
                playerDir   = 4;
                facingFront = true;
                facingBack  = false;
                facingLeft  = false;
                facingRight = false;
            }
            if (playerDir / 45 == -3)
            {
                playerDir = 5;
            }
            int rando = Random.Range(0, 3);
            switch (rando)
            {
            case 0:
                Sound.me.PlaySound(mvt, .15f, 2, 3);
                break;

            case 1:
                Sound.me.PlaySound(mvt2, .15f, 2, 3);
                break;

            case 2:
                Sound.me.PlaySound(mvt3, .15f, 2, 3);
                break;
            }
        }
    }
Пример #16
0
 void curveMove(float inc)
 {
     dirAsFloat = GlobalFxns.ToAng(direction);
     linearMove(direction, velocity, acceleration, minvelocity, maxvelocity, ticks);
     direction = GlobalFxns.ToVect(dirAsFloat + inc);
 }