Ejemplo n.º 1
0
        public void Attack()
        {
            // Schießt ein Shot auf den Player
            if (Main.GameTimeUpdate.TotalGameTime.TotalSeconds - lastAttack > ratOfFire)
            {
                lastAttack = Main.GameTimeUpdate.TotalGameTime.TotalSeconds;

                Random r = new Random();
                float acc = 0.3F;
                Vector2 accuracy = new Vector2((float)(r.NextDouble() * acc - acc / 2), (float)(r.NextDouble() * acc - acc / 2));
                Vector2 direction = -LocationBehavior.Direction + accuracy;

                // Schuss erstellen
                Shot s = new Shot(0, 0, 1000, direction, Damage, "", 0, "", 0, new MapLocation(LocationBehavior.Position));

                // Je nach Gegner andere SchussGrafik
                switch (TypOfEnemy)
                {
                    case EEnemyType.E1:
                    case EEnemyType.E2:
                        s.Renderer = LoadedRenderer.DefaultRenderer["S_Shot_Monster_01"];
                        break;
                    case EEnemyType.E3:
                    case EEnemyType.E4:
                        s.Renderer = LoadedRenderer.DefaultRenderer["S_Shot_Monster_02"];
                        break;
                    case EEnemyType.E5:
                    case EEnemyType.E6:
                        s.Renderer = LoadedRenderer.DefaultRenderer["S_Shot_Monster_03"];
                        break;
                    default:
                        s.Renderer = LoadedRenderer.DefaultRenderer["S_Shot_Normal"];
                        break;
                }

                // TEST BUFF
                if (TypOfEnemy == EEnemyType.E5 || TypOfEnemy == EEnemyType.E6)
                    s.AddBuff(new Buff(0, 10, 5, EBuffType.FireDamage));

                s.SetDirection(direction);
                s.LocationSizing();

                // Play Sound
                Sound.Sounds["Monster_Attack_02"].Play();

                // Schuss in gameState liste aufnehmen
                Main.MainObject.GameManager.GameState.ShotListVsPlayer.Add(s);
            }
        }
Ejemplo n.º 2
0
        // ***************************************************************************
        // schießen
        public Shot CreateShot()
        {
            //Debug.WriteLine("RateOfFire: " + RateOfFire);

            // Cooldown setzen
            ResetCooldown();

            // Schuss erzeugen
            //Shot s = Item.DefaultShots[Munition.ShotId].Clone();
            Shot s = new Shot( 750F, Damage, 2000 );
            s.Renderer = Munition.ShotRenderer;
            s.Damage = Damage;

            // Munition abziehen
            Munition.Count -= 1;

            //if (Munition.Count <= 0)
            //Main.MainObject.GameManager.GameState.Player.RemoveItemFromInventar(Item.Get(Munition.TypeId));
            return s;
        }
Ejemplo n.º 3
0
        /// <summary>
        ///   Player wird von Schuss getroffen. Bekommt Damage und die Buffs des Schusses
        /// </summary>
        /// <param name="shot"> Schuss der den Spieler trifft </param>
        public void TakeDamage(Shot shot)
        {
            // Schaden abziehen
            Health = Health - shot.Damage;

            // Buffs übernehmen
            AddBuffs(shot.Buffs);
        }
Ejemplo n.º 4
0
 // ***************************************************************************
 // Clont Object
 public Shot Clone()
 {
     Shot s = new Shot(TypeId, Group, Speed, new Vector2(Direction.X, Direction.Y), Damage, Name, Distance, Description, Weight, LocationBehavior.Clone());
     s.Renderer = Renderer;
     return s;
 }