Example #1
0
        private int GetRemainingSlottedStructure(Component_SlottedContainer slottedContainer)
        {
            var q = new GameQuery_EntityAttribute(EntityAttributeType.STRUCTURE, slottedContainer.Parent);

            q.RegisterBaseValue(0);
            return(((GameQuery_EntityAttribute)slottedContainer.HandleQuery(q)).Value);
        }
Example #2
0
        private void AssignDamagePoint(Component_SlottedContainer slottedContainer)
        {
            // Damge from the BOTTOM UP, so that the hand goes last
            // TODO: Maybe kinda counterintuitive?
            var target = slottedContainer.InspectStoredEntities()
                         .Where(e => this.GetRemainingInternalStructure(e) > 0)
                         .Reverse()
                         .First();
            var damageEvent = new GameEvent_TakeDamage(1);

            target.HandleEvent(damageEvent);

            if (!damageEvent.Completed)
            {
                throw new ArgumentException("Target didn't take damage when it should have!");
            }
        }