mta-mono/Test/Program.cs

40 lines
934 B
C#
Raw Permalink Normal View History

using System;
2017-02-23 13:08:59 +00:00
using System.Linq;
using System.Collections.Generic;
using MultiTheftAuto;
using MultiTheftAuto.EventArgs;
2017-02-23 13:08:59 +00:00
using Console = MultiTheftAuto.Console;
namespace Test
{
public class Program
{
static void Main( string[] args )
{
2017-02-23 13:08:59 +00:00
Event.AddHandler( "onElementDestroy", Resource.Root, new Action<Vehicle>( Vehicle_OnElementDestroy ) );
2015-12-12 10:10:23 +00:00
2017-02-23 13:08:59 +00:00
for( int i = 0; i < 8; i++ )
{
Vehicle vehicle = new Vehicle( VehicleModel.SULTAN + i, Vector3.Zero, Vector3.Zero );
}
2015-12-12 10:10:23 +00:00
2017-02-23 13:08:59 +00:00
Debug.Info( "------------------------------------" );
2017-02-23 13:08:59 +00:00
foreach( Vehicle vehicle in Element.GetByType( "vehicle" ) )
{
Debug.Info( string.Format( "{0} {1}", vehicle.GetVehicleType(), vehicle.GetName() ) );
2017-02-23 13:08:59 +00:00
vehicle.Destroy();
}
2017-02-23 13:08:59 +00:00
Debug.Info( "------------------------------------" );
}
2017-02-23 13:08:59 +00:00
static void Vehicle_OnElementDestroy( Vehicle sender )
{
2017-02-23 13:08:59 +00:00
Console.WriteLine( "onElementDestroy: " + sender.GetName() );
}
}
}