summaryrefslogtreecommitdiff
path: root/source/game/items/CooldownItemActions.cs
blob: 647661eba55fd92a4f5dc044ea672dd0fe9ef5c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
using Celesteia.Game.Planets;
using Microsoft.Xna.Framework;
using MonoGame.Extended.Entities;

namespace Celesteia.Game.Items {
    public class CooldownItemActions : IItemActions {
        public double UseTime = 1.0;
        public double LastUse = 0.0;
        public void UpdateLastUse(GameTime gameTime) => LastUse = gameTime.TotalGameTime.TotalSeconds;
        public bool CheckUseTime(GameTime gameTime) => gameTime.TotalGameTime.TotalSeconds - LastUse >= UseTime;

        public virtual bool Assert(GameTime gameTime) => CheckUseTime(gameTime);

        public virtual bool Primary(GameTime gameTime, ChunkMap chunkMap, Point cursor, Entity user) => false;
        public virtual bool Secondary(GameTime gameTime, ChunkMap chunkMap, Point cursor, Entity user) => false;
    }
}