kiki/coffee/stone.coffee
monsterkodi 2e4c5e5233 levels
2016-08-21 23:07:33 +02:00

37 lines
1.1 KiB
CoffeeScript

# 0000000 000000000 0000000 000 000 00000000
# 000 000 000 000 0000 000 000
# 0000000 000 000 000 000 0 000 0000000
# 000 000 000 000 000 0000 000
# 0000000 000 0000000 000 000 00000000
Pushable = require './pushable'
class Stone extends Pushable
constructor: (opt) ->
@slippery = opt?.slippery or false
@color = 0xff8800
if opt?.color
if Array.isArray opt.color
@color = new THREE.Color opt.color[0], opt.color[1], opt.color[2]
else
@color = opt.color
@geom = new THREE.BoxGeometry 0.98,0.98,0.98
@mat = new THREE.MeshPhongMaterial
color: @color
side: THREE.DoubleSide
shading: THREE.SmoothShading
transparent: true
opacity: opt?.opacity ? 0.7
shininess: 20
@mesh = new THREE.Mesh @geom, @mat
@mesh.receiveShadow = true
@mesh.castShadow = true
super
isSlippery: -> return @slippery
module.exports = Stone