本文整理汇总了Golang中github.com/vova616/GarageEngine/engine.Arbiter类的典型用法代码示例。如果您正苦于以下问题:Golang Arbiter类的具体用法?Golang Arbiter怎么用?Golang Arbiter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Arbiter类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: OnCollisionEnter
func (pu *PowerUp) OnCollisionEnter(arbiter engine.Arbiter) bool {
if pu.GameObject() != nil && (arbiter.GameObjectA() == Player || arbiter.GameObjectB() == Player) {
PowerUpShip(pu.Type)
pu.GameObject().Destroy()
}
return true
}
示例2: OnCollisionExit
func (c *Chest) OnCollisionExit(arbiter engine.Arbiter) {
if arbiter.GameObjectB() != nil {
if arbiter.GameObjectB().Tag == "player" {
c.playerIn = false
}
}
}
示例3: OnCollisionEnter
func (c *Chest) OnCollisionEnter(arbiter engine.Arbiter) bool {
if arbiter.GameObjectB().Tag == "player" {
c.playerIn = true
}
return true
}
示例4: OnCollisionExit
func (pl *Player) OnCollisionExit(arbiter engine.Arbiter) {
if arbiter.GameObjectB() == pl.pSplint {
pl.pSplint = nil
} else if arbiter.GameObjectB() == pl.pLader {
pl.pLader = nil
pl.GameObject().Physics.Body.IgnoreGravity = false
pl.GameObject().Sprite.SetAnimation("player_stand")
}
}
示例5: OnCollisionEnter
func (s *Item) OnCollisionEnter(arbiter engine.Arbiter) bool {
if arbiter.GameObjectB() != nil {
if arbiter.GameObjectB().Tag == "player" {
if s.takeable {
s.coll(s.GameObject())
s.GameObject().Destroy()
}
}
}
return true
}
示例6: OnCollisionEnter
func (sp *PlayerController) OnCollisionEnter(arbiter engine.Arbiter) bool {
//println("Enter " + arbiter.GameObjectB().Name())
count := 0
for _, con := range arbiter.Contacts {
//println(arbiter.Normal(con).Y)
if -arbiter.Normal(con).Y > 0.9 {
count++
}
}
if count >= 2 {
sp.Floor = arbiter.GameObjectB()
}
return true
}
示例7: OnCollisionEnter
func (ds *Destoyable) OnCollisionEnter(arbiter engine.Arbiter) bool {
if !ds.Alive {
return true
}
var dmg *DamageDealer = nil
var enemyDestoyable *Destoyable
enemy := arbiter.GameObjectB()
if enemy == nil {
return true
}
dmg, _ = enemy.ComponentTypeOf(dmg).(*DamageDealer)
enemyDestoyable, _ = enemy.ComponentTypeOf(enemyDestoyable).(*Destoyable)
if enemyDestoyable == nil || enemyDestoyable.Team == ds.Team {
return true
}
if dmg != nil {
ds.HP -= dmg.Damage
}
if ds.destoyableFuncs != nil {
ds.destoyableFuncs.OnHit(enemy, dmg)
}
if ds.HP <= 0 {
ds.Alive = false
if ds.destoyableFuncs != nil {
ds.destoyableFuncs.OnDie(false)
} else {
ds.GameObject().Destroy()
}
}
return true
}
示例8: OnCollisionPostSolve
func (pl *Player) OnCollisionPostSolve(arbiter engine.Arbiter) {
if arbiter.GameObjectB() == nil {
return
}
if arbiter.GameObjectB().Tag != "lader" && arbiter.GameObjectA().Tag != "lader" {
count := 0
for _, con := range arbiter.Contacts {
if arbiter.Normal(con).Y < -0.9 {
count++
}
}
if count >= 1 {
if pl.GameObject().Sprite.CurrentAnimation() == "player_jump" {
pl.GameObject().Sprite.SetAnimation("player_stand")
}
pl.LastFloor = arbiter.GameObjectB()
pl.OnGround = true
}
}
}
示例9: OnCollisionEnter
func (pl *Player) OnCollisionEnter(arbiter engine.Arbiter) bool {
if arbiter.GameObjectB().Tag == "lader" {
pl.pLader = arbiter.GameObjectB()
if pl.GameObject().Sprite.CurrentAnimation() != "player_climb" {
pl.GameObject().Sprite.SetAnimation("player_climb")
}
pl.GameObject().Physics.Body.IgnoreGravity = true
pl.OnGround = false
}
if pl.Hitable && arbiter.GameObjectB().Tag == "splinter" {
pl.pSplint = arbiter.GameObjectB()
engine.StartCoroutine(func() {
for pl.pSplint != nil {
pl.Hit()
engine.CoYieldCoroutine(pl.Hitted)
}
})
}
return true
}
示例10: OnCollisionPostSolve
func (s *Enemy) OnCollisionPostSolve(arbiter engine.Arbiter) {
if arbiter.GameObjectB() != nil {
if arbiter.GameObjectB().Tag != "lader" && arbiter.GameObjectA().Tag != "lader" {
count := 0
for _, con := range arbiter.Contacts {
if arbiter.Normal(con).Y < -0.9 {
count++
}
}
if count >= 1 {
if s.GameObject().Sprite.CurrentAnimation() == "enemy_jump" {
s.GameObject().Sprite.SetAnimation("enemy_stand")
}
s.LastFloor = arbiter.GameObjectB()
s.OnGround = true
}
count = 0
for _, con := range arbiter.Contacts {
if math.Abs(float64(arbiter.Normal(con).X)) > 0.9 {
count++
}
}
if count >= 1 {
s.jump = true
}
if arbiter.GameObjectB().Tag == "player" {
if Player.PlComp.Hitable && s.Attack {
Player.PlComp.Hit()
}
if s.hitable && Player.PlComp.Attack {
s.Hit()
}
}
}
}
}
示例11: OnCollisionExit
func (sp *PlayerController) OnCollisionExit(arbiter engine.Arbiter) {
if arbiter.GameObjectB() == sp.Floor {
sp.Floor = nil
}
}