Example #1
0
    void Awake()
    {
        if (!AudioController.Instance)
        {
            audioController = GetComponent <AudioController>();
            audioLibrary    = GetComponent <AudioLibrary>();

            audioController.CreateInstance();
            AudioController.SetUpController(audioLibrary, 2);
        }
        else
        {
            Destroy(gameObject);
        }
    }
Example #2
0
        public Turret(Texture2D spritesheet, Rectangle hitbox, List <Vector2> hitPolyPoints, Vector2 hitboxoffset)
            : base(spritesheet, hitbox, hitPolyPoints, hitboxoffset)
        {
            _idleAnim = new SpriteAnim(spritesheet, 4, 2, 16, 16, 200, new Vector2(8, 8), true, false, 0);
            _idleAnim.Play();
            _hitAnim = new SpriteAnim(spritesheet, 10, 2, 16, 16, 200, new Vector2(8, 8), true, false, _idleAnim.CurrentFrame);
            _hitAnim.Play();

            gunLoop          = AudioController.CreateInstance("minigun");
            gunLoop.IsLooped = true;
            gunLoop.Volume   = 0f;
            gunLoop.Play();
            gunLoop.Pause();

            Speed.X = Helper.Random.Next(2) == 0 ? -0.1f : 0.1f;
        }
Example #3
0
        public Flyer(Texture2D spritesheet, Rectangle hitbox, List <Vector2> hitPolyPoints, Vector2 hitboxoffset)
            : base(spritesheet, hitbox, hitPolyPoints, hitboxoffset)
        {
            _idleAnim = new SpriteAnim(spritesheet, 0, 1, 16, 16, 100, new Vector2(8, 8), false, false, 0);
            _idleAnim.Pause();
            _hitAnim = new SpriteAnim(spritesheet, 6, 1, 16, 16, 100, new Vector2(8, 8), false, false, _idleAnim.CurrentFrame);
            _hitAnim.Pause();

            _faceDir = Helper.Random.Next(2) == 0 ? -1 : 1;

            gunLoop          = AudioController.CreateInstance("minigun");
            gunLoop.IsLooped = true;
            gunLoop.Volume   = 0f;
            gunLoop.Play();
            gunLoop.Pause();
        }
Example #4
0
        public Boss(Texture2D spritesheet, Rectangle hitbox, List <Vector2> hitPolyPoints, Vector2 hitboxoffset)
            : base(spritesheet, hitbox, hitPolyPoints, hitboxoffset)
        {
            _idleAnim = new SpriteAnim(spritesheet, 0, 1, 32, 32, 0, new Vector2(16, 16));
            _hitAnim  = new SpriteAnim(spritesheet, 5, 1, 32, 32, 0, new Vector2(16, 16));

            _headGobAnim    = new SpriteAnim(spritesheet, 1, 2, 32, 32, 0, new Vector2(16, 16));
            _headGobAnimHit = new SpriteAnim(spritesheet, 6, 2, 32, 32, 0, new Vector2(16, 16));
            _headEyeAnim    = new SpriteAnim(spritesheet, 2, 6, 32, 32, 0, new Vector2(16, 16));
            _headEyeAnimHit = new SpriteAnim(spritesheet, 7, 6, 32, 32, 0, new Vector2(16, 16));
            _bodyAnim       = new SpriteAnim(spritesheet, 3, 1, 32, 32, 0, new Vector2(16, 16));
            _bodyAnimHit    = new SpriteAnim(spritesheet, 8, 1, 32, 32, 0, new Vector2(16, 16));
            _tailAnim       = new SpriteAnim(spritesheet, 4, 1, 32, 32, 0, new Vector2(16, 16));
            _tailAnimHit    = new SpriteAnim(spritesheet, 9, 1, 32, 32, 0, new Vector2(16, 16));

            laughLoop        = AudioController.CreateInstance("boss");
            laughLoop.Volume = 0f;
            laughLoop.Pause();
        }
Example #5
0
        public Ship(Texture2D spritesheet, Rectangle hitbox, List <Vector2> hitPolyPoints, Vector2 hitboxoffset)
            : base(spritesheet, hitbox, hitPolyPoints, hitboxoffset)
        {
            Instance = this;

            engineLoop          = AudioController.CreateInstance("boost");
            engineLoop.Volume   = 0f;
            engineLoop.IsLooped = true;
            engineLoop.Play();
            engineLoop.Pause();
            engineLoop.Volume = 0.3f;
            gunLoop           = AudioController.CreateInstance("minigun");
            gunLoop.IsLooped  = true;
            gunLoop.Volume    = 0f;
            gunLoop.Play();
            gunLoop.Pause();
            gunLoop.Volume   = 0.3f;
            hitLoop          = AudioController.CreateInstance("shiphit");
            hitLoop.IsLooped = false;
            hitLoop.Volume   = 1f;


            _idleAnim = new SpriteAnim(spritesheet, 0, 1, 16, 16, 100, new Vector2(8, 8));
            _idleAnim.Play();
            _upAnim = new SpriteAnim(spritesheet, 1, 2, 16, 16, 500, new Vector2(8, 8), false, false, 0);
            _upAnim.Pause();
            _downAnim = new SpriteAnim(spritesheet, 2, 2, 16, 16, 500, new Vector2(8, 8), false, false, 0);
            _downAnim.Pause();

            _idleHitAnim = new SpriteAnim(spritesheet, 3, 1, 16, 16, 100, new Vector2(8, 8));
            _idleHitAnim.Play();
            _upHitAnim = new SpriteAnim(spritesheet, 4, 2, 16, 16, 500, new Vector2(8, 8), false, false, 0);
            _upHitAnim.Pause();
            _downHitAnim = new SpriteAnim(spritesheet, 5, 2, 16, 16, 500, new Vector2(8, 8), false, false, 0);
            _downHitAnim.Pause();

            Active = true;
        }