Example #1
0
 public EnemyObj(string spriteName, PlayerObj target, PhysicsManager physicsManager, ProceduralLevelScreen levelToAttachTo, GameTypes.EnemyDifficulty difficulty)
     : base(spriteName, physicsManager, levelToAttachTo)
 {
     base.DisableCollisionBoxRotations = true;
     this.Type = 0;
     base.CollisionTypeTag = 3;
     this.m_target = target;
     this.m_walkingLB = new LogicBlock();
     this.m_currentActiveLB = new LogicBlock();
     this.m_cooldownLB = new LogicBlock();
     this.logicBlocksToDispose = new List<LogicBlock>();
     this.m_resetSpriteName = spriteName;
     this.Difficulty = difficulty;
     this.ProjectileScale = new Vector2(1f, 1f);
     base.PlayAnimation(true);
     this.PlayAnimationOnRestart = true;
     base.OutlineWidth = 2;
     this.GivesLichHealth = true;
     this.DropsItem = true;
 }
        // GET: Components
        public ActionResult Index(string searchString)
        {
            LogicBlock[] lbs = ProcessConnectionManager.GetLogicBlocks();
            if (lbs == null)
            {
                LogicBlock lb_Error = new LogicBlock();
                lb_Error.ID       = -1;
                lb_Error.TypeName = "error. nothing found";
                lbs = new LogicBlock[1] {
                    lb_Error
                };

                return(View(lb_Error));
            }
            else
            {
                if (!String.IsNullOrEmpty(searchString))
                {
                    lbs = lbs.Where(s => s.ID.ToString().Contains(searchString) || s.TypeName.Contains(searchString)).ToArray();
                }
            }
            return(View(lbs));
        }
Example #3
0
 public override void Update(GameTime gameTime)
 {
     float num = (float)gameTime.ElapsedGameTime.TotalSeconds;
     if (this.m_initialDelayCounter > 0f)
     {
         this.m_initialDelayCounter -= num;
     }
     else
     {
         if (this.m_invincibleCounter > 0f)
         {
             this.m_invincibleCounter -= num;
         }
         if (this.m_invincibleCounterProjectile > 0f)
         {
             this.m_invincibleCounterProjectile -= num;
         }
         if (this.m_invincibleCounter <= 0f && this.m_invincibleCounterProjectile <= 0f && !base.IsWeighted)
         {
             if (base.AccelerationY < 0f)
             {
                 base.AccelerationY += 15f;
             }
             else if (base.AccelerationY > 0f)
             {
                 base.AccelerationY -= 15f;
             }
             if (base.AccelerationX < 0f)
             {
                 base.AccelerationX += 15f;
             }
             else if (base.AccelerationX > 0f)
             {
                 base.AccelerationX -= 15f;
             }
             if (base.AccelerationY < 3.6f && base.AccelerationY > -3.6f)
             {
                 base.AccelerationY = 0f;
             }
             if (base.AccelerationX < 3.6f && base.AccelerationX > -3.6f)
             {
                 base.AccelerationX = 0f;
             }
         }
         if (!base.IsKilled && !this.IsPaused)
         {
             this.DistanceToPlayer = CDGMath.DistanceBetweenPts(base.Position, this.m_target.Position);
             if (this.DistanceToPlayer > (float)this.EngageRadius)
             {
                 base.State = 0;
             }
             else if (this.DistanceToPlayer < (float)this.EngageRadius && this.DistanceToPlayer >= (float)this.ProjectileRadius)
             {
                 base.State = 1;
             }
             else if (this.DistanceToPlayer < (float)this.ProjectileRadius && this.DistanceToPlayer >= (float)this.MeleeRadius)
             {
                 base.State = 2;
             }
             else
             {
                 base.State = 3;
             }
             if (this.m_cooldownTimer > 0f && this.m_currentActiveLB == this.m_cooldownLB)
             {
                 this.m_cooldownTimer -= (float)gameTime.ElapsedGameTime.TotalSeconds;
             }
             if (this.m_cooldownTimer <= 0f && this.m_runCooldown)
             {
                 this.m_runCooldown = false;
             }
             if (!base.LockFlip)
             {
                 if (!this.AlwaysFaceTarget)
                 {
                     if (base.Heading.X < 0f)
                     {
                         this.Flip = SpriteEffects.FlipHorizontally;
                     }
                     else
                     {
                         this.Flip = SpriteEffects.None;
                     }
                 }
                 else if (base.X > this.m_target.X)
                 {
                     this.Flip = SpriteEffects.FlipHorizontally;
                 }
                 else
                 {
                     this.Flip = SpriteEffects.None;
                 }
             }
             if (!this.m_currentActiveLB.IsActive && !this.m_runCooldown)
             {
                 switch (this.Difficulty)
                 {
                 case GameTypes.EnemyDifficulty.BASIC:
                     this.RunBasicLogic();
                     break;
                 case GameTypes.EnemyDifficulty.ADVANCED:
                     this.RunAdvancedLogic();
                     break;
                 case GameTypes.EnemyDifficulty.EXPERT:
                     this.RunExpertLogic();
                     break;
                 case GameTypes.EnemyDifficulty.MINIBOSS:
                     this.RunMinibossLogic();
                     break;
                 }
                 if (this.m_runCooldown && this.m_currentActiveLB.ActiveLS.Tag == 2)
                 {
                     this.m_cooldownTimer = this.CooldownTime;
                 }
             }
             if (!this.m_currentActiveLB.IsActive && this.m_runCooldown && this.m_cooldownTimer > 0f && !this.m_cooldownLB.IsActive)
             {
                 this.m_currentActiveLB = this.m_cooldownLB;
                 this.m_currentActiveLB.RunLogicBlock(this.m_cooldownParams);
             }
             if (base.IsWeighted && this.m_invincibleCounter <= 0f && this.m_invincibleCounterProjectile <= 0f)
             {
                 if (base.HeadingX > 0f)
                 {
                     base.HeadingX = 1f;
                 }
                 else if (base.HeadingX < 0f)
                 {
                     base.HeadingX = -1f;
                 }
                 base.X += base.HeadingX * (base.CurrentSpeed * num);
             }
             else if (this.m_isTouchingGround || !base.IsWeighted)
             {
                 base.Position += base.Heading * (base.CurrentSpeed * num);
             }
             if (base.X < (float)this.m_levelScreen.CurrentRoom.Bounds.Left)
             {
                 base.X = (float)this.m_levelScreen.CurrentRoom.Bounds.Left;
             }
             else if (base.X > (float)this.m_levelScreen.CurrentRoom.Bounds.Right)
             {
                 base.X = (float)this.m_levelScreen.CurrentRoom.Bounds.Right;
             }
             if (base.Y < (float)this.m_levelScreen.CurrentRoom.Bounds.Top)
             {
                 base.Y = (float)this.m_levelScreen.CurrentRoom.Bounds.Top;
             }
             else if (base.Y > (float)this.m_levelScreen.CurrentRoom.Bounds.Bottom)
             {
                 base.Y = (float)this.m_levelScreen.CurrentRoom.Bounds.Bottom;
             }
             if (this.m_currentActiveLB == this.m_cooldownLB)
             {
                 this.m_currentActiveLB.Update(gameTime);
             }
             else
             {
                 this.m_currentActiveLB.Update(gameTime);
                 this.m_cooldownLB.Update(gameTime);
             }
         }
     }
     if (base.IsWeighted)
     {
         this.CheckGroundCollision();
     }
     if (base.CurrentHealth <= 0 && !base.IsKilled && !this.m_bossVersionKilled)
     {
         this.Kill(true);
     }
     base.Update(gameTime);
 }
Example #4
0
 public override void Dispose()
 {
     if (!base.IsDisposed)
     {
         if (this.m_currentActiveLB.IsActive)
         {
             this.m_currentActiveLB.StopLogicBlock();
         }
         this.m_currentActiveLB = null;
         foreach (LogicBlock current in this.logicBlocksToDispose)
         {
             current.Dispose();
         }
         for (int i = 0; i < this.logicBlocksToDispose.Count; i++)
         {
             this.logicBlocksToDispose[i] = null;
         }
         this.logicBlocksToDispose.Clear();
         this.logicBlocksToDispose = null;
         this.m_target = null;
         this.m_walkingLB.Dispose();
         this.m_walkingLB = null;
         if (this.m_cooldownLB.IsActive)
         {
             this.m_cooldownLB.StopLogicBlock();
         }
         this.m_cooldownLB.Dispose();
         this.m_cooldownLB = null;
         if (this.m_engageRadiusTexture != null)
         {
             this.m_engageRadiusTexture.Dispose();
         }
         this.m_engageRadiusTexture = null;
         if (this.m_engageRadiusTexture != null)
         {
             this.m_projectileRadiusTexture.Dispose();
         }
         this.m_projectileRadiusTexture = null;
         if (this.m_engageRadiusTexture != null)
         {
             this.m_meleeRadiusTexture.Dispose();
         }
         this.m_meleeRadiusTexture = null;
         if (this.m_cooldownParams != null)
         {
             Array.Clear(this.m_cooldownParams, 0, this.m_cooldownParams.Length);
         }
         this.m_cooldownParams = null;
         this.TintablePart = null;
         this.m_flipTween = null;
         base.Dispose();
     }
 }
Example #5
0
 protected void SetCooldownLogicBlock(LogicBlock cooldownLB, params int[] percentage)
 {
     this.m_cooldownLB = cooldownLB;
     this.m_cooldownParams = percentage;
 }
Example #6
0
 protected void RunLogicBlock(bool runCDLogicAfterward, LogicBlock block, params int[] percentage)
 {
     this.m_runCooldown = runCDLogicAfterward;
     this.m_currentActiveLB = block;
     this.m_currentActiveLB.RunLogicBlock(percentage);
 }