Ejemplo n.º 1
0
 private void Start()
 {
     inventory = GetComponent <ShellInventory>();
     firepoint = transform.Find("GunRotationParent").Find("Gun").Find("FirePoint").gameObject;
     inventory.AddShell(0, 5);
     currentShell = Shells.singleton.FindShellByID(0);
 }
Ejemplo n.º 2
0
        public ShellBase CreateShell(ShellBase parent)
        {
            var mainCreated = _mainCreated;

            _mainCreated = true;
            return(CreateCustomShell(() => CreateShell(!mainCreated), parent));
        }
Ejemplo n.º 3
0
 public CompilerResult(Kind kind, string sourceFile, string outFile, ShellBase shell)
 {
     Kind          = kind;
     OutputFile    = outFile;
     SourceFile    = sourceFile;
     Succeeded     = (shell.ExitCode == 0);
     ErrorList     = shell.StandardError.GetErrors();
     ExecutionTime = (shell.ExitTime.Ticks - shell.StartTime.Ticks);
 }
        public ShellBase CreateShell(ShellBase parent)
        {
            var rv = CreateShell(!_shells.Any());

            if (parent != null)
            {
                rv.Owner = parent;
            }
            return(rv);
        }
Ejemplo n.º 5
0
    public void ChangeShell(int shellID)
    {
        ShellBase shell = Shells.singleton.FindShellByID(shellID);

        if (shell == null)
        {
            return;
        }

        currentShell = shell;
    }
Ejemplo n.º 6
0
    public void ReleaseShell(ShellBase shell)
    {
        ShellConfig cfg = Config.ShellCfg[shell.ID - 1];

        if (shell.Hole != null)
        {
            ReleasePrefab(cfg.hole, shell.Hole);
        }
        shell.OnDetach();
        shell.OnUninit();
        ReleasePrefab(cfg.prefab, shell.gameObject);
    }
Ejemplo n.º 7
0
    public ShellBase CreateShell(int weaponid, Transform parent)
    {
        WeaponConfig weapon = Config.WeaponCfg[weaponid - 1];
        ShellConfig  cfg    = Config.ShellCfg[weapon.shell - 1];
        GameObject   obj    = CreatePrefab(cfg.prefab);
        ShellBase    shell  = obj.GetComponent <ShellBase>();

        shell.gameObject.SetActive(true);
        shell.transform.parent        = parent;
        shell.transform.localPosition = Vector3.zero;
        shell.transform.localRotation = Quaternion.identity;
        shell.ID       = cfg.id;
        shell.WeaponID = weaponid;
        shell.name     = "shell_" + cfg.id;
        shell.OnInit();
        return(shell);
    }
Ejemplo n.º 8
0
        public ShellBase CreateCustomShell(Func <ShellBase> creationAction, ShellBase parent)
        {
            var       t     = this;
            ShellBase shell = null;

            if (parent != null)
            {
                parent.Dispatcher.Invoke(() =>
                {
                    shell       = creationAction();
                    shell.Owner = parent;

                    // Register newly created shell base for existing thread.
                    _dictionary[shell.Dispatcher.Thread].Add(shell);
                });
            }
            else
            {
                var mre    = new ManualResetEventSlim();
                var thread = new Thread(() =>
                {
                    shell = creationAction();
                    mre.Set();
                    Dispatcher.CurrentDispatcher.UnhandledException += DomainExceptionHandler.OnUnhandledDispatcherException;
                    Dispatcher.Run();
                });
                thread.SetApartmentState(ApartmentState.STA);
                thread.IsBackground = true;
                thread.Start();
                thread.Name = "Window thread";
                mre.Wait();

                // Register new thread with newly created shell base.
                _dictionary[thread] = new List <ShellBase>()
                {
                    shell
                };
            }

            shell.Closed += ShellOnClosed;

            return(shell);
        }
Ejemplo n.º 9
0
 /// <inheritdoc />
 public void Unloading(ShellBase owner)
 {
     Debugger.Break();
 }
Ejemplo n.º 10
0
 /// <inheritdoc />
 public void Navigated(ShellBase owner, ShellBase parent)
 {
     Debugger.Break();
 }
 public ShellBase CreateCustomShell(Func <ShellBase> creationAction, ShellBase parent)
 {
     return(creationAction());
 }
Ejemplo n.º 12
0
 private void Start()
 {
     shell = Shells.singleton.FindShellByID(0);
 }
Ejemplo n.º 13
0
 public void SetShell(ShellBase shell)
 {
     this.shell = shell;
 }