Exemple #1
0
        private void TimeExpired(AbstractEntity entity)
        {
            ExplodesWhenTimerExpiresComponent explodes = (ExplodesWhenTimerExpiresComponent)entity.GetComponent(nameof(ExplodesWhenTimerExpiresComponent));

            if (explodes != null)
            {
            }
        }
        public void Explosion(AbstractEntity entity)
        {
            ExplodesWhenTimerExpiresComponent ewtec = (ExplodesWhenTimerExpiresComponent)entity.GetComponent(nameof(ExplodesWhenTimerExpiresComponent));
            PositionComponent pos = ECSHelper.GetPosition(entity);

            foreach (var e in this.entities)
            {
                PositionComponent epos = ECSHelper.GetPosition(e);
                if (epos != null)
                {
                    if (GeometryFunctions.Distance(epos.x, epos.y, pos.x, pos.y) <= ewtec.range)
                    {
                        if (this.checkVis.CanSee(epos.x, epos.y, pos.x, pos.y))
                        {
                            this.damageSystem.Damage(e, ewtec.power, $"Exploding {entity.name}");
                        }
                    }
                }
            }
        }