void OnDestroy()
 {
     if (this.name == "NW_Shell")
     {
         BossWeapon bW = transform.parent.FindChild("Core").FindChild("NW").GetComponentInChildren <BossWeapon>();
         bW.enabled          = true;
         bW.speedMultiplyer *= 2;
     }
     if (this.name == "NE_Shell")
     {
         BossWeapon bW = transform.parent.FindChild("Core").FindChild("NE").GetComponentInChildren <BossWeapon>();
         bW.enabled          = true;
         bW.speedMultiplyer *= 2;
     }
     if (this.name == "SW_Shell")
     {
         BossWeapon bW = transform.parent.FindChild("Core").FindChild("SW").GetComponentInChildren <BossWeapon>();
         bW.enabled          = true;
         bW.speedMultiplyer *= 2;
     }
     if (this.name == "SE_Shell")
     {
         BossWeapon bW = transform.parent.FindChild("Core").FindChild("SE").GetComponentInChildren <BossWeapon>();
         bW.enabled          = true;
         bW.speedMultiplyer *= 2;
     }
 }
Beispiel #2
0
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     player     = GameObject.FindGameObjectWithTag("Player").transform;
     rb         = animator.GetComponent <Rigidbody2D>();
     boss       = animator.GetComponent <Boss>();
     bossWeapon = animator.GetComponent <BossWeapon>();
 }
 public JBEnemyCharacterData(int level)
 {
     number         = 0;
     name           = "";
     weapon         = BossWeapon.none;
     movemode       = MovingMode.none;
     attackmode     = 0;
     attackpower    = 0;
     attackdistance = 0;
     existType      = BossExistType.NONE;
     hp             = 0;
     speed          = 0;
     score          = 0;
 }
Beispiel #4
0
    void OnCollisionEnter(Collision col)
    {
        Enemy enemy = col.collider.gameObject.GetComponent <Enemy>();

        if (enemy)
        {
            collidedWithEnemy(enemy);
        }
        BossWeapon bossweapon = col.collider.gameObject.GetComponent <BossWeapon>();

        if (bossweapon)
        {
            collidedWithEnemy(bossweapon);
        }
    }
Beispiel #5
0
    protected override void Start()
    {
        _collider         = GetComponent <Collider2D>();
        _collider.enabled = false;
        _bossWeapon       = GetComponent <BossWeapon>();

        base.Start();

        Camera cam = Camera.main;

        _maxY = cam.ScreenToWorldPoint(new Vector3(0f, Screen.height * 0.9f, 0f)).y;
        _minY = cam.ScreenToWorldPoint(new Vector3(0f, Screen.height * 0.1f, 0)).y;
        _midY = (_minY + _maxY) / 2;

        StartCoroutine(MoveToMiddle());
    }
Beispiel #6
0
    void collidedWithEnemy(BossWeapon bossweapon)
    {
        bossweapon.Attack(this);
        if (health <= 0)
        {
            Time.timeScale = 0;
            string temp;
            temp  = "您坚持了 ";
            temp += time.text_timeSpend.text;
            //onPlayerDeath(this);
            //UnityEditor.EditorUtility.DisplayDialog("游戏结束", temp, "确认");
            die.SetActive(true);
            //Time.timeScale = 1;

            //jump();
        }
    }
Beispiel #7
0
 public void SetWeapon(BossWeapon _weapon)
 {
     if (_weapon.Equals(BossWeapon.Range))
     {
         trails = meleeCollider.GetComponentsInChildren <MeleeWeaponTrail>();
         foreach (MeleeWeaponTrail trail in trails)
         {
             trail.DestroyTrail();
         }
         rangeWeapon.SetActive(true);
         meleeWeapon.SetActive(false);
     }
     else
     {
         rangeWeapon.SetActive(false);
         meleeWeapon.SetActive(true);
     }
 }
Beispiel #8
0
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     timer  = Random.Range(minTime, maxTime);
     weapon = animator.GetComponent <BossWeapon>();
 }
Beispiel #9
0
        public static void LoadContent(Game1 game)
        {
            mobBulletTexture = game.Content.Load <Texture2D>("Bullet");
            Texture2D tex = game.Content.Load <Texture2D>("BossSpriteSheet");

            AnimationState[] animations = new AnimationState[1];
            animations[0]      = new AnimationState(AnimationState.AnimationType.Idle, 0, 0, 4, 100f);
            noShootAnimations  = animations;
            shootAnimations    = new AnimationState[1];
            shootAnimations[0] = new AnimationState(AnimationState.AnimationType.Idle, 1, 0, 4, 100f);
            BossWeapon[] bossWeapons = new BossWeapon[2];
            SoundEffect  sound       = game.Content.Load <SoundEffect>("GameSounds/bossshoot");

            bossShoot      = sound;
            bossWeapons[0] = new BossWeapon(mobBulletTexture, sound);
            bossWeapons[1] = new BossWeapon(mobBulletTexture, sound);
            Healthbar health = new Healthbar(game.Content.Load <Texture2D>("healthbar"), 50, 10, Game1.WIDTH / 2 - 100, 50);

            LargeBoss            = new Boss(health, tex, game.Content.Load <SoundEffect>("GameSounds/bossdefeat"), animations, 88, 89, new Vector2(Game1.WIDTH / 4 - (90 * 4) / 2, -80 * 4), 1, 90 * 4, 80 * 4, bossWeapons);
            basicEnemyTexture    = game.Content.Load <Texture2D>("EnemySpriteSheet");
            BasicMob             = new BasicMob(basicEnemyTexture, noShootAnimations, 43, 42, new Vector2(0, 0), 5, 45, 40);
            basicShootingTexture = game.Content.Load <Texture2D>("EnemySpriteSheet");
            sound    = game.Content.Load <SoundEffect>("GameSounds/playershoot");
            mobShoot = sound;
            Weapon shootWeapon = new MobWeapon(mobBulletTexture, sound);

            BasicShootingMob = new ShootingMob(basicEnemyTexture, noShootAnimations, 43, 42, new Vector2(0, 0), 5, 45, 40, shootWeapon);
            random           = new Random();

            spawnLocations = new List <WaveLocation>();

            MobSpawn[] spawns  = new MobSpawn[4];
            int        spacing = (Game1.WIDTH / 2 - BasicMob.MobWidth * 4) / 4;
            int        offset  = (Game1.WIDTH / 4 - (spacing * 2) + BasicMob.MobWidth / 2);

            for (int i = 0; i < spawns.Length; i++)
            {
                spawns[i] = new MobSpawn(new Vector2(spacing * i + offset, -BasicMob.MobHeight), 0f, MobType.FastMob);
            }
            spawnLocations.Add(new WaveLocation("The Quad", spawns));

            spawns  = new MobSpawn[8];
            spacing = BasicMob.MobWidth;
            offset  = (Game1.WIDTH / 2 - BasicMob.MobWidth * 4);
            for (int i = 0; i < spawns.Length / 2; i++)
            {
                spawns[i] = new MobSpawn(new Vector2(spacing * i, -BasicMob.MobHeight), 0f, MobType.ShootMob);
            }
            for (int i = spawns.Length / 2; i < spawns.Length; i++)
            {
                spawns[i] = new MobSpawn(new Vector2(spacing * (i - 4) + offset, -BasicMob.MobHeight), 0f, MobType.FastMob);
            }
            spawnLocations.Add(new WaveLocation("Double Trouble", spawns));

            spawns  = new MobSpawn[4];
            spacing = (Game1.WIDTH / 2 - BasicMob.MobWidth * 4) / 4;
            offset  = (Game1.WIDTH / 4 - (spacing * 2) + BasicMob.MobWidth / 2);
            for (int i = 0; i < spawns.Length; i++)
            {
                int yoff = 0;
                if (i != 0 && i != 3)
                {
                    yoff      = -BasicMob.MobHeight;
                    spawns[i] = new MobSpawn(new Vector2(spacing * i + offset, -BasicMob.MobHeight + yoff), 0f, MobType.BasicMob);
                }
                else
                {
                    spawns[i] = new MobSpawn(new Vector2(spacing * i + offset, -BasicMob.MobHeight + yoff), 0f, MobType.ShootMob);
                }
            }
            spawnLocations.Add(new WaveLocation("The Quad Offset", spawns));

            spawns  = new MobSpawn[(Game1.WIDTH / 2) / BasicMob.MobWidth];
            spacing = BasicMob.MobWidth;
            offset  = (Game1.WIDTH / 2 - ((Game1.WIDTH / 2) / BasicMob.MobWidth) * BasicMob.MobWidth) / 2;
            for (int i = 0; i < spawns.Length; i++)
            {
                if (i % 3 != 0)
                {
                    spawns[i] = new MobSpawn(new Vector2(spacing * i + offset, -BasicMob.MobHeight), 0f, MobType.BasicMob);
                }
                else
                {
                    spawns[i] = new MobSpawn(new Vector2(spacing * i + offset, -BasicMob.MobHeight), 0f, MobType.ShootMob);
                }
            }
            spawnLocations.Add(new WaveLocation("The Wall", spawns));

            spawns  = new MobSpawn[((Game1.WIDTH / 2) / BasicMob.MobWidth) - 8];
            spacing = BasicMob.MobWidth;
            offset  = (Game1.WIDTH / 2 - ((Game1.WIDTH / 2) / BasicMob.MobWidth) * BasicMob.MobWidth) / 2 + BasicMob.MobWidth * 4;
            for (int i = 0; i < spawns.Length; i++)
            {
                spawns[i] = new MobSpawn(new Vector2(spacing * i + offset, -BasicMob.MobHeight), 0f, MobType.ShootMob);
            }
            spawnLocations.Add(new WaveLocation("Firing Squad", spawns));

            spawns  = new MobSpawn[4];
            spacing = Game1.WIDTH / 2 - BasicMob.MobWidth;
            offset  = 0;
            for (int i = 0; i < spawns.Length / 2; i++)
            {
                spawns[i] = new MobSpawn(new Vector2(spacing * i, -BasicMob.MobHeight), 180f * i, MobType.SideMob);
            }
            for (int i = spawns.Length / 2; i < spawns.Length; i++)
            {
                spawns[i] = new MobSpawn(new Vector2(spacing * (i - 2), -BasicMob.MobHeight * 2), 180f * (i - 2), MobType.SideMob);
            }
            spawnLocations.Add(new WaveLocation("Sidewinder", spawns));
        }