Exemple #1
0
        public Cat(Guid id, Vector2 position)
        {
            this.id = id;
            this.position = position;
            this.textureKey = "cat";
            this.origin = new Vector2(Data.GetTextureSize(textureKey).X / 2, Data.GetTextureSize(textureKey).Y * 0.85f);
            this.movementSpeed = 2;
            this.interactRange = 100;
            this.interactionCooldown = 3000;
            this.attackDamage = 1;
            this.interactionCooldown = 5000;
            this.attackDamage = 6;
            this.health = 100;
            this.mobState = mobState;
            isInteractable = true;

            Map.InsertGameObject(this);

            MoveToPostionMobState MovPosState = new MoveToPostionMobState(new Vector2(position.X, position.Y), this);
            MoveToPostionMobState MovPosState2 = new MoveToPostionMobState(new Vector2(position.X - 200, position.Y), this);
            IdleMobState idleMobState = new IdleMobState(3, this);
            MovPosState.NextState = idleMobState;
            idleMobState.NextState = MovPosState2;
            MovPosState2.NextState = MovPosState;
            mobState = MovPosState;
        }
Exemple #2
0
 public void HandleMobState(MoveToPostionMobState leState)
 {
     if (!leState.IsActive)
     {
         leState.Activate();
     }
     else if (leState.CheckState())
     {
         leState.IsActive = false;
         mobState = leState.NextState;
     }
 }