Example #1
0
        private void InitProperties()
        {
            layer        = Layers.Character;
            hpBar        = State.Content.Load <Texture2D>("GUI/HPBar");
            walkingSound = new SoundEffect2D(SoundsDepository.Walking.CreateInstance(), this)
            {
                Volume          = 0.3f,
                IsLooping       = true,
                DistanceDivider = 20
            };

            //inicialize base attributes
            baseAttributes = new Dictionary <Attributes, int>();
            foreach (Attributes stat in Enum.GetValues(typeof(Attributes)))
            {
                baseAttributes.Add(stat, 10);
            }

            CollisionDisplaytList = new List <CollisionToDisplay>();

            autoAttackTimer = baseAttackSpeed;
        }
Example #2
0
        public virtual void Initialize(Vector2 position, int damage, DamageType damageType, Vector2 direction, Faction faction
                                       , SoundEffectInstance flyingSoundInstance, SoundEffectInstance hitSoundInstance, Character parent = null)
        {
            Position   = position;
            Damage     = damage;
            DamageType = damageType;
            Direction  = direction;
            Direction.Normalize();
            Angle   = Math.Atan(Direction.Y / Direction.X);
            Faction = faction;
            Parent  = parent;

            flyingSound = new SoundEffect2D(flyingSoundInstance, this)
            {
                IsLooping = true,
                Volume    = 0.4f
            };
            hitSound = new SoundEffect2D(hitSoundInstance, this)
            {
                IsLooping = false,
                Volume    = 0.5f
            };
            flyingSound.Play();
        }