public void CollideWithLava() { if (HitByLavaReset == true) { return; } PlayerCharacter.InRunAnimation = false; GameSimulation.Sim.PlaySound("ack.caf"); // Blink for a second SCNAction blinkOffAction = SCNAction.FadeOut(0.15f); SCNAction blinkOnAction = SCNAction.FadeIn(0.15f); SCNAction cycle = SCNAction.Sequence(new SCNAction[] { blinkOffAction, blinkOnAction }); SCNAction repeatCycle = SCNAction.RepeatAction(cycle, 17); HitByLavaReset = true; PlayerCharacter.RunAction(repeatCycle, () => { TimeAlongPath = 0; PlayerCharacter.Position = LocationAlongPath(TimeAlongPath); PlayerCharacter.Rotation = GetPlayerDirectionFromCurrentPosition(); HitByLavaReset = false; }); }
public void WasTouchedByEnemy() { var time = DateTime.UtcNow.Ticks; if (time > this.lastHitTime + 1d) { this.lastHitTime = time; this.model.RunAction(SCNAction.Sequence(new SCNAction[] { SCNAction.PlayAudioSource(this.hitSound, false), SCNAction.RepeatAction(SCNAction.Sequence(new SCNAction[] { SCNAction.FadeOpacityTo(0.01f, 0.1f), SCNAction.FadeOpacityTo(1f, 0.1f) }), 4) })); } }
void WasHit() { if (isInvincible) { return; } isInvincible = true; Character.Hit(); Character.Node.RunAction(SCNAction.Sequence(new [] { SCNAction.PlayAudioSource(hitSound, false), SCNAction.RepeatAction(SCNAction.Sequence(new [] { SCNAction.FadeOpacityTo(.01f, 0.1), SCNAction.FadeOpacityTo(1f, 0.1) }), 7), SCNAction.Run(_ => isInvincible = false) })); }