Vtj.Contest.Race.RaceLevel.Crash C# (CSharp) Method

Crash() public method

public Crash ( ) : void
return void
        public void Crash()
        {
            if (Status == RaceStatus.Crashing) return;

            Speed = 9;
            Status = RaceStatus.Crashing;
            CarSystem.CarObject.StartAnimation("Crash");
        }

Usage Example

Ejemplo n.º 1
0
        public override void Update(CanvasContext2D context)
        {
            foreach (Npc npc in _npcs)
            {
                npc.Object.Visible = false;
                npc.Distance      += npc.Speed * _level.DeltaTime;

                float distance = npc.Distance - _level.Position;

                if (distance <= 0 || distance > _level.DistanceTable[RaceLevel.Lines])
                {
                    continue;
                }

                float scale = 3500 / distance;

                float y = 600 + (1000000 / distance) - 300;
                float x = 425 + npc.X * scale + _level.Shifts[Math.Floor(600 - y)];

                if (Number.IsNaN(x))
                {
                    continue;
                }

                int index = 3;
                if (distance < 30000)
                {
                    int angle = Math.Floor(_level.Shifts[Math.Floor(600 - y)] + (npc.X * 3500) / distance);
                    index = Math.Floor(Math.Abs(angle) / 60);
                    if (index > 3)
                    {
                        index = 3;
                    }
                    index = 3 + index * (angle / Math.Abs(angle));
                    if (Number.IsNaN(index))
                    {
                        index = 3;
                    }
                }

                npc.Object.Update();
                npc.Object.Visible      = true;
                npc.Object.Location     = new Vector3D(x, y, npc.Distance);
                npc.Object.Scale        = scale;
                npc.Object.CurrentFrame = index;

                if (distance < 4500 && Math.Abs(npc.Object.Location.X - _level.CarSystem.CarObject.Location.X) < 100)
                {
                    _level.Crash();
                }
            }
        }
All Usage Examples Of Vtj.Contest.Race.RaceLevel::Crash