override protected void onCollision(bool enter, RelPos p, GO other) { Type otherType = Type.Error; this.issueEvent <RemoteGetType>( (x, y) => x.Get(out otherType), other); if (otherType > Type.Followable) { collCtx ctx; ctx.enter = enter; ctx.p = p; ctx.other = other; ctx.otherType = otherType; if (enter) { this.onCollisionEnter(ctx); } else { this.onCollisionExit(ctx); } } }
public void OnFinishMovement(Dir d) { bool slip = false; if (d == this.facing || this.facing == Dir.None) { /* If on ice (and nothing in front), repeat */ GO obj = getObjectAt(RelPos.Bottom); if (obj != null) { Type blockType = Type.Error; this.issueEvent <RemoteGetType>( (x, y) => x.Get(out blockType), obj); slip = (blockType == Type.IceBlock); } slip = (slip && (getObjectAt(RelPos.Front) == null)); } if (slip) { this.uncheckedMove(d, this.lastDelay); } else { this.anim &= ~Animation.Move; } }
private void onCollisionCenter(bool enter, RelPos p, GO other) { Type type = Type.Error; this.issueEvent <RemoteGetType>((x, y) => x.Get(out type), other); if (enter && type == Type.Player) { Global.Sfx.playCheckpoint(this.transform); this.rootEvent <LoaderEvents>( (x, y) => x.SetActiveCheckpoint(this.checkPointIdx)); this.destroy(); this.setCollisionCb(RelPos.Center, null); } }
override protected void start() { System.Action <bool, RelPos, GO> cb; base.start(); cb = (x, y, z) => this.onCollision(x, y, z); this.setCollisionCb(RelPos.None, cb); this.target = null; this.targetPriority = Type.None; this.selfT = this.gameObject.transform; this.bgFunc = null; this.rootEvent <LoaderEvents>((x, y) => x.IncreaseMaxMinion()); }
private void onCenter(bool enter, RelPos p, GO other) { Type otherType = Type.Error; this.issueEvent <RemoteGetType>( (x, y) => x.Get(out otherType), other); if (otherType != Type.Player && otherType != Type.Minion) { /* Avoid triggering the death scene while rendering the * level thumbnails */ if (SceneMng.GetActiveScene().name != LevelSelectScene) { Global.Sfx.playPlayerCrushed(this.fastGetTr()); SceneMng.LoadSceneAsync("YouLose", SceneMode.Additive); } this.gameObject.SetActive(false); } }
private void onCollisionEnter(collCtx ctx) { if (this.targetPriority >= ctx.otherType || (ctx.otherType == Type.Minion && this.follower != null)) { return; } this.target = ctx.other; this.otherT = ctx.other.transform; this.targetPriority = ctx.otherType; if (ctx.otherType == Type.Minion) { this.issueEvent <Leader>( (x, y) => x.SetFollower(this), ctx.other); } }
private void onCollisionExit(collCtx ctx) { if (this.target == ctx.other) { Dir moveDir; if (this.targetPriority == Type.Minion) { this.issueEvent <Leader>( (x, y) => x.RemoveFollower(this), ctx.other); } /* The target we were following just left, try to move after it */ this.target = null; this.targetPriority = Type.None; moveDir = vec3ToDir(otherT.position - this.selfT.position); this.StartCoroutine(this.follow(ctx.other, moveDir)); } }
private void checkCondition(GO other) { Type objType = Type.Error; bool done = false; this.issueEvent <RemoteGetType>((x, y) => x.Get(out objType), other); if (objType != Type.Minion) { return; } this.issueEvent <SetOnGoal>((x, y) => x.OnGoal(), other); this.rootEvent <LoaderEvents>((x, y) => x.SavedMinion(out done)); if (done) { this.rootEvent <LoaderEvents>((x, y) => x.NextLevel()); } }
private void checkCondition(GO other) { Type objType = Type.Error; this.issueEvent <RemoteGetType>((x, y) => x.Get(out objType), other); if (objType != Type.Player) { return; } this.getAnimator(); if (this.animator != null) { this.animator.SetTrigger(GoalBlock.trigger); } /* Halt player movement */ this.issueEvent <SetOnGoal>((x, y) => x.OnGoal(), other); this.showWinScreen(); }
private void onCollisionUp(bool enter, RelPos p, GO other) { Type objType = Type.Error; bool onLedge = false; this.issueEvent <RemoteGetType>((x, y) => x.Get(out objType), other); if (objType != Type.Minion && objType != Type.Player) { return; } this.issueEvent <OnLedgeDetector>((x, y) => x.Check(out onLedge), other); if (enter && !onLedge) { this.updateCrackedStateEnter(); } else if (!enter) { this.updateCrackedStateExit(); } }