Class: Zyps::DestroyAction

Inherits:
Action
  • Object
show all
Defined in:
lib/zyps/actions.rb

Overview

Destroy the targets.

Direct Known Subclasses

EatAction

Instance Attribute Summary collapse

Attributes inherited from Action

#started

Instance Method Summary collapse

Methods inherited from Action

#copy, #start, #started?, #stop

Constructor Details

#initialize(environment) ⇒ DestroyAction

Returns a new instance of DestroyAction.



133
134
135
# File 'lib/zyps/actions.rb', line 133

def initialize(environment)
	self.environment = environment
end

Instance Attribute Details

#environmentObject

The environment to remove objects from.



132
133
134
# File 'lib/zyps/actions.rb', line 132

def environment
  @environment
end

Instance Method Details

#do(actor, targets) ⇒ Object

Remove the target from the environment.



137
138
139
140
141
# File 'lib/zyps/actions.rb', line 137

def do(actor, targets)
	targets.each do |target|
		@environment.objects.delete(target)
	end
end