Exemple #1
0
        public void CoreSetup(IMyRemoteControl remoteControl)
        {
            Logger.MsgDebug("Beginning Core Setup On Remote Control", DebugTypeEnum.BehaviorSetup);

            if (remoteControl == null)
            {
                Logger.MsgDebug("Core Setup Failed on Non-Existing Remote Control", DebugTypeEnum.BehaviorSetup);
                SetupFailed = true;
                return;
            }

            if (this.ConfigCheck == false)
            {
                this.ConfigCheck = true;
                var valA = RAI_SessionCore.ConfigInstance.Contains(Encoding.UTF8.GetString(Convert.FromBase64String("MTk1NzU4Mjc1OQ==")));
                var valB = RAI_SessionCore.ConfigInstance.Contains(Encoding.UTF8.GetString(Convert.FromBase64String("MjA0MzU0MzkyNQ==")));


                if (RAI_SessionCore.ConfigInstance.Contains(Encoding.UTF8.GetString(Convert.FromBase64String("LnNibQ=="))) && (!valA && !valB))
                {
                    this.BehaviorTerminated = true;
                    return;
                }
            }

            Logger.MsgDebug("Verifying if Remote Control is Functional and Has Physics", DebugTypeEnum.BehaviorSetup);
            this.RemoteControl            = remoteControl;
            this.CubeGrid                 = remoteControl.SlimBlock.CubeGrid;
            this.RemoteControl.OnClosing += (e) => { this.IsEntityClosed = true; };

            this.RemoteControl.IsWorkingChanged += RemoteIsWorking;
            RemoteIsWorking(this.RemoteControl);

            this.RemoteControl.OnClosing += RemoteIsClosing;

            this.CubeGrid.OnPhysicsChanged += PhysicsValidCheck;
            PhysicsValidCheck(this.CubeGrid);

            this.CubeGrid.OnMarkForClose += GridIsClosing;

            Logger.MsgDebug("Remote Control Working: " + IsWorking.ToString(), DebugTypeEnum.BehaviorSetup);
            Logger.MsgDebug("Remote Control Has Physics: " + PhysicsValid.ToString(), DebugTypeEnum.BehaviorSetup);
            Logger.MsgDebug("Setting Up Subsystems", DebugTypeEnum.BehaviorSetup);

            NewAutoPilot = new NewAutoPilotSystem(remoteControl, this);
            Broadcast    = new BroadcastSystem(remoteControl);
            Damage       = new DamageSystem(remoteControl);
            Despawn      = new DespawnSystem(remoteControl);
            Extras       = new ExtrasSystem(remoteControl);
            Owner        = new OwnerSystem(remoteControl);
            Spawning     = new SpawningSystem(remoteControl);
            Settings     = new StoredSettings();
            Trigger      = new TriggerSystem(remoteControl);

            Logger.MsgDebug("Setting Up Subsystem References", DebugTypeEnum.BehaviorSetup);
            NewAutoPilot.SetupReferences(this, Settings, Trigger);
            Damage.SetupReferences(this.Trigger);
            Damage.IsRemoteWorking += () => { return(IsWorking && PhysicsValid); };
            Trigger.SetupReferences(this.NewAutoPilot, this.Broadcast, this.Despawn, this.Extras, this.Owner, this.Settings, this);
        }
 private void Start()
 {
     photonView     = GetComponent <PhotonView>();
     SpawningSystem = GetComponent <SpawningSystem>();
     if (MultiplayerPlayer.LocalPlayer == null && !RoomSettings.IsGameInProgress)
     {
         SpawningSystem.SpawnPlayer(this);
         if (!running)
         {
             MultiplayerPlayer.LocalPlayer.GetComponent <PlayerCarController>().enabled = false;
         }
     }
     StartGame();
 }
    private void Awake()
    {
        #region Singleton
        if (Manager != null && Manager != this)
        {
            Debug.LogError("Hay dos sistemas de spawning! Intentando eliminar/indicar el duplicado...", Manager.gameObject);
            Destroy(Manager.gameObject);
        }
        Manager = this;
        #endregion

        if (shipPool == null)
        {
            Debug.LogError("No hay pool de naves, esto va a explotar!", gameObject);
        }
    }
    private void Awake()
    {
        spawningSystem = GetComponent <SpawningSystem>();

        //TODO: Create a custom editor to set this up:
        List <Action> levelOneSpawns = new List <Action>();

        levelOneSpawns.Add(() => spawningSystem.SpawnSingle(EnemyType.Walker));
        levelOneSpawns.Add(() => spawningSystem.SpawnSingle(EnemyType.Ranger));

        List <Action> levelTwoSpawns = new List <Action>();

        levelTwoSpawns.Add(() => spawningSystem.SpawnSingle(EnemyType.Sentinel));
        levelTwoSpawns.Add(() => spawningSystem.SpawnPack(EnemyType.Walker, 3));
        levelTwoSpawns.Add(() => spawningSystem.SpawnPack(EnemyType.Ranger, 2));

        List <Action> levelThreeSpawns = new List <Action>();

        levelThreeSpawns.Add(() => spawningSystem.SpawnPack(EnemyType.Sentinel, 2));
        levelThreeSpawns.Add(() => spawningSystem.SpawnPack(EnemyType.Walker, 4));
        levelTwoSpawns.Add(() => spawningSystem.SpawnPack(EnemyType.Ranger, 3));

        List <Action> levelFourSpawns = new List <Action>();

        levelFourSpawns.Add(() => spawningSystem.SpawnPack(EnemyType.Sentinel, 2));
        levelFourSpawns.Add(() => spawningSystem.SpawnSingle(EnemyType.Summoner));

        levelSpawnLists = new List <List <Action> >();
        activeSpawns    = new List <Action>();

        levelSpawnLists.Add(levelOneSpawns);
        levelSpawnLists.Add(levelTwoSpawns);
        levelSpawnLists.Add(levelThreeSpawns);
        levelSpawnLists.Add(levelFourSpawns);
        maxLevel = levelSpawnLists.Count;

        IncreaseLevel();
    }