kiki/coffee/item.coffee
monsterkodi 557fa7c219 bomb
2016-08-19 01:25:34 +02:00

58 lines
1.6 KiB
CoffeeScript

# 000 000000000 00000000 00 00
# 000 000 000 000 000
# 000 000 0000000 000000000
# 000 000 000 000 0 000
# 000 000 00000000 000 000
log = require '/Users/kodi/s/ko/js/tools/log'
Actor = require './actor'
Pos = require './lib/pos'
Vector = require './lib/vector'
Quaternion = require './lib/quaternion'
class Item extends Actor
constructor: ->
super
@name = @constructor.name
@createMesh?()
world.scene.add @mesh if @mesh?
@position = new Vector
@current_position = new Vector
@direction = new Vector
@move_action = null
del: ->
super
# log "item del !!!!!!!!!!!!!!!!!!!!!! #{@name}"
world.scene.remove @mesh if @mesh?
world.removeObject @
@emit 'deleted'
newCellMate: ->
cellMateLeft: ->
bulletImpact: ->
render: ->
isSpaceEgoistic: -> false
isSlippery: -> false
setPosition: (x,y,z) ->
@position = new Vector x,y,z
@current_position = new Vector x,y,z
@mesh?.position.copy @position
getPos: -> new Pos @current_position
setPos: (x,y,z) ->
p = new Pos x,y,z
@position = @current_position = new Vector p
setOrientation: (q) ->
@current_orientation = @orientation = new Quaternion q
# log "item.setOrientation:", @orientation
setCurrentPosition: (p) -> @current_position = p
setCurrentOrientation: (q) -> @current_orientation = q
module.exports = Item