public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        var spawnerData = new LevelSpawn
        {
            // The referenced prefab will be converted due to DeclareReferencedPrefabs.
            // So here we simply map the game object to an entity reference to that prefab.
            Prefab = conversionSystem.GetPrimaryEntity(Prefab),
            Size   = Size
        };

        dstManager.AddComponentData(entity, spawnerData);
    }
Esempio n. 2
0
    void Spawn(Entity entity, LevelSpawn levelSpawnFromEntity)
    {
        // Create our new Bot entity
        var instance = EntityManager.Instantiate(levelSpawnFromEntity.Prefab);

        EntityManager.SetComponentData(instance, new Translation {
            Value = new float3()
        });
        EntityManager.AddComponentData(instance, new LevelSize {
            X = levelSpawnFromEntity.Size.x, Y = levelSpawnFromEntity.Size.y
        });

        EntityManager.DestroyEntity(entity);
    }
Esempio n. 3
0
 // Use this for initialization
 void Start()
 {
     timeForSpawn = timeForFirstSpawn;
     sceneManager = GameObject.Find("SceneManager").GetComponent <SceneManager>();
     gridSpawner  = GameObject.Find("LevelSpawner").GetComponent <LevelSpawn>();
     tags         = new string[5];
     for (int i = 0; i < tags.Length; i++)
     {
         tags[i] = "Lane" + (i + 1);
     }
     spawnPoints = new Vector3[5];
     for (int i = 0; i < 5; i++)
     {
         spawnPoints[i] = new Vector3(8.5f + gridSpawner.xGridOffset, i + gridSpawner.yGridOffset, -.15f);
     }
     fishToSpawn = enemies.Count;
 }
Esempio n. 4
0
        private void OnEnable()
        {
            _target = (LevelSpawn)target;

            Mode          = serializedObject.FindProperty(nameof(Mode));
            AgentHeight   = serializedObject.FindProperty(nameof(AgentHeight));
            AgentSize     = serializedObject.FindProperty(nameof(AgentSize));
            ForwardMode   = serializedObject.FindProperty(nameof(ForwardMode));
            ResetForwardY = serializedObject.FindProperty(nameof(ResetForwardY));

            HitMask = serializedObject.FindProperty(nameof(HitMask));

            SpawnName = serializedObject.FindProperty(nameof(SpawnName));
            IsDefault = serializedObject.FindProperty(nameof(IsDefault));

            // Try to refresh the database!
            SharedEditorDataManager.TryRefreshDatabaseAtStart();
        }
Esempio n. 5
0
        public override void Create()
        {
            base.Create();

            var levelMgr = ScriptThread.GetOrAddExtension <LevelManager>();

            var sessMgr = ScriptThread.GetOrAddExtension <SessionManager>();

            LevelSpawn spawnPoint = levelMgr.GetSpawnPoint(Info.Sess.TeamNum);

            // spawn above to avoid collision with teammates.

            Vector3 position = Utility.EnsureValidSpawnPos(spawnPoint.Position + new Vector3(0, 0, 2.0f));

            Model model = new Model(VehicleHash.Lazer);

            if (!model.IsLoaded)
            {
                model.Request(1000);
            }

            var vehicle = World.CreateVehicle(model, position, spawnPoint.Heading);

            vehicle.LodDistance   = 2000;
            vehicle.EngineRunning = true;
            vehicle.BodyHealth    = 1000;

            vehicle.MaxSpeed = 280.0f;

            Function.Call(Hash.SET_VEHICLE_EXPLODES_ON_HIGH_EXPLOSION_DAMAGE, vehicle, true);

            Ped ped = Game.Player.Character;

            TeamData team = sessMgr.GetTeamByIndex(Info.Sess.TeamNum);

            ped.RelationshipGroup = team.RelationshipGroup;

            ped.SetIntoVehicle(vehicle, VehicleSeat.Driver);

            Manage(ped, vehicle);
        }
Esempio n. 6
0
 // Use this for initialization
 void Awake()
 {
     player     = GameObject.FindGameObjectWithTag("Player");
     inventory  = player.GetComponent <PlayerInventory> ();
     levelSpawn = GameObject.Find("LevelSpawnMarker").GetComponent <LevelSpawn> ();
 }
Esempio n. 7
0
 // Use this for initialization
 void Awake()
 {
     player = GameObject.FindGameObjectWithTag("Player");
     inventory = player.GetComponent<PlayerInventory> ();
     levelSpawn = GameObject.Find ("LevelSpawnMarker").GetComponent<LevelSpawn> ();
 }
Esempio n. 8
0
        public override void Create()
        {
            base.Create();

            var levelMgr = ScriptThread.GetOrAddExtension <LevelManager>();

            var sessMgr = ScriptThread.GetOrAddExtension <SessionManager>();

            LevelSpawn spawnPoint = levelMgr.GetSpawnPoint(Info.Sess.TeamNum);

            Vector3 position = Utility.EnsureValidSpawnPos(spawnPoint.Position);

            Debug.Assert(position != null, "AIPlayer.Create: Position was invalid.");

            Debug.Assert(position != Vector3.Zero, "AIPlayer.Create: Position was invalid.");

            Model model = new Model(new VehicleHash[] {
                VehicleHash.Lazer,
                VehicleHash.Besra,
                VehicleHash.Hydra
            }.GetRandomItem());

            //  Model model = new Model(VehicleHash.Lazer);

            if (!model.IsLoaded)
            {
                model.Request(1000);
            }

            var vehicle = World.CreateVehicle(model, position, spawnPoint.Heading);

            vehicle.LodDistance   = 2000;
            vehicle.EngineRunning = true;

            vehicle.BodyHealth = 0.01f;

            vehicle.SteeringScale = 5.0f;

            vehicle.PetrolTankHealth = 0.1f;

            vehicle.Health = 10;

            //     vehicle.MaxSpeed = 210;

            vehicle.MaxSpeed = 310.0f;

            Function.Call(Hash.SET_VEHICLE_EXPLODES_ON_HIGH_EXPLOSION_DAMAGE, vehicle, true);

            model = new Model(PedHash.Pilot02SMM);

            if (!model.IsLoaded)
            {
                model.Request(1000);
            }

            Ped ped = World.CreatePed(model, position);

            TeamData team = sessMgr.GetTeamByIndex(Info.Sess.TeamNum);

            ped.RelationshipGroup = team.RelationshipGroup;

            Function.Call(Hash.SET_PED_COMBAT_ATTRIBUTES, ped, 1, 1);

            Function.Call(Hash.SET_PED_COMBAT_ATTRIBUTES, ped, 52, 0);

            ped.SetIntoVehicle(vehicle, VehicleSeat.Driver);

            Function.Call(Hash.SET_CURRENT_PED_VEHICLE_WEAPON, ped, 0x7E0EDF1E);

            Function.Call(Hash.SET_PED_CAN_SWITCH_WEAPON, ped, false);

            Function.Call(Hash.SET_DRIVE_TASK_MAX_CRUISE_SPEED, ped, 400.0f);
            //
            //  Function.Call(Hash.DISABLE_VEHICLE_WEAPON, true, 0x7E0EDF1E, vehicle, ped); //vehicle_weapon_enemy_lazer
            //
            //  Function.Call(Hash.DISABLE_VEHICLE_WEAPON, true, 0xCF0896E0, vehicle, ped); //VEHICLE_WEAPON_PLANE_ROCKET

            //  Function.Call(Hash.DISABLE_VEHICLE_WEAPON, true, 0xF8A3939F, vehicle, ped); //VEHICLE_WEAPON_PLANE_ROCKET

            //  Function.Call(Hash.DISABLE_VEHICLE_WEAPON, true, 0x9F1A91DE, vehicle, ped); //VEHICLE_WEAPON_PLANE_ROCKET

            // Function.Call(Hash.DISABLE_VEHICLE_WEAPON, true, 0xE2822A29, vehicle, ped); //VEHICLE_WEAPON_PLANE_ROCKET                   w

            Manage(ped, vehicle);
        }
Esempio n. 9
0
 public void Init(LevelSpawn levelSpawn)
 {
     passedPoint += levelSpawn.CreateLevel;
     defeat      += levelSpawn.StartLevel;
 }