Example #1
0
        public BranchTrap(Vector2 spritePosition, string spriteSheetName = "branchTrap", DrawManager.Layer layer = DrawManager.Layer.Middleground) : base(spritePosition, spriteSheetName, layer)
        {
            CanWalkable = true;
            CreateColliders();

            List <float> randomNumbers = new List <float>
            {
                1.5f,
                2f,
                3f,
                4f,
            };

            randomTimesGetOff = new List <float>();

            while (randomNumbers.Count > 0)
            {
                float randomNumber = randomNumbers[RandomGenerator.GetRandom(0, randomNumbers.Count)];
                randomTimesGetOff.Add(randomNumber);

                randomNumbers.Remove(randomNumber);
            }

            indexGetOff   = 0;
            playerAnimDie = Player.State.DeathMashed;

            audioSource3D = new AudioSource3D(this);

            clipUp = AudioManager.GetAudioClip("branchUp");

            animations[(int)AnimationType.Down].LoopAtFrame(4);
            animations[(int)AnimationType.Up].LoopAtFrame(4);
            Animation.IsActive = true;
            ChangeAnim(AnimationType.Down);
        }
Example #2
0
        public Fire(Vector2 spritePosition, string spriteSheetName = "fire") : base(spritePosition, spriteSheetName, DrawManager.Layer.Foreground)
        {
            sprite.scale = new Vector2(1f, 0.65f);

            PhysicsManager.RemoveItem(RigidBody);

            Rect rect = new Rect(Vector2.Zero, null, Width / 1.8f, Height);

            RigidBody = new RigidBody(spritePosition, this, null, rect);
            RigidBody.SetCollisionMask((uint)PhysicsManager.ColliderType.Player);

            currAnim      = AnimationType.Start;
            timeLoop      = TIME_LOOP_FIRE;
            playerAnimDie = Player.State.DeathBurnt;
            IsActive      = false;

            audioSourceFire = new AudioSource3D(this);

            clipFireBurn = AudioManager.GetAudioClip("fireBurn");
            clipBurned   = AudioManager.GetAudioClip("clipBurn");
        }
 public static void AddAudioSource3D(AudioSource3D source3D)
 {
     audioSources3D.Add(source3D);
 }