Inheritance: MonoBehaviour
Example #1
0
    // Start is called before the first frame update
    void Start()
    {
        if (player1)
        {
            axissetting  = "Horizontal";
            inputsetting = "w";
            blocksetting = "s";
        }
        else
        {
            axissetting  = "Vertical";
            inputsetting = "up";
            blocksetting = "down";
        }

        lifeController = gameObject.GetComponent <LifeController>();
        lifeController.setLife(maxLife);

        reload = gameObject.GetComponent <Reload>();
        reload.setBullet(limitedBullets);

        life     = maxLife;
        playable = false;
        blocked  = false;
        shooting = true;
    }
Example #2
0
        void OnApplicationActivated()
        {
            if (mException != null)
            {
                return;
            }

            Reload.IfWorkspaceConfigChanged(
                mPlasticAPI, mWkInfo, mIsGluonMode,
                ExecuteFullReload);

            if (mWkInfo == null)
            {
                return;
            }

            ((IWorkspaceWindow)mWorkspaceWindow).UpdateTitle();

            NewIncomingChanges.LaunchUpdater(
                mDeveloperNewIncomingChangesUpdater,
                mGluonNewIncomingChangesUpdater);

            // When Unity Editor window is activated it writes some files to its Temp folder.
            // This causes the fswatcher to process those events.
            // We need to wait until the fswatcher finishes processing the events,
            // otherwise the NewChangesInWk method will return TRUE, causing
            // the pending changes view to unwanted auto-refresh.
            // So, we need to delay the auto-refresh call in order
            // to give the fswatcher enough time to process the events.
            // Note that the OnFocus event is not affected by this issue.
            mCooldownAutoRefreshPendingChangesAction.Ping();

            mViewSwitcher.AutoRefreshIncomingChangesView();
        }
    IEnumerator ReloadingSequence()
    {
        Reload.Play();
        Reloading = true;
        Anim.SetBool("IsReloading", true);
        Anim.SetBool("IsAiming", false);
        Anim.SetBool("IsShooting", false);
        yield return(new WaitForSeconds(2.5f));

        if (Shots > 0) //if the shots are bigger than 0, then subtract the Whole Ammo from the remainder of a the Ammo Clip to create a Full Ammo Clip
        {
            Ammoleft -= ShotsFired;
            Shots     = full;
        }
        if (Shots <= 0) //if the shots are less than or equal than 0, then refill the Empty Clip to a Full Clip abd subtract it from the Whole Ammo
        {
            Ammoleft -= full;
            Shots     = full;
        }
        if (Shots > 0 && Ammoleft < 0) //if the shots are bigger than 0 and the Whole Ammo left is less than 0, then add the last ammount of Ammo into the clip
        {
            Shots    += Ammoleft;
            Ammoleft -= ShotsFired;
        }
        Anim.SetBool("IsReloading", false);
        ShotsFired = 0; //return the remainder to 0
        Reloading  = false;
    }
Example #4
0
 // Use this for initialization
 void Start()
 {
     building     = true;
     PlayerCamera = GameObject.Find("Main Camera").GetComponent <Camera>();
     reloadValue  = transform.Find("Reloader").gameObject;
     r            = reloadValue.GetComponent <Reload> ();
 }
 void NotifyReload(NodeProxy proxy, bool reloadChildren)
 {
     if (proxy != null)
     {
         Reload?.Invoke(this, new ReloadEventArgs(proxy, reloadChildren));
     }
 }
Example #6
0
    internal void Equip(int index)
    {
        DeactivateWeaopns();
        canfire      = true;
        canSwitch    = true;
        activeWeapon = weapons[index];
        activeWeapon.Equip();
        for (int i = 0; i < weapons.Length; i++)
        {
            weapons[i].gameObject.SetActive(true);
        }

        if (weapons[index].name == "Sword")
        {
            swordIcon.SetActive(true);
            gunIcon.SetActive(false);
        }
        if (weapons[index].name == "Hand Gun")
        {
            gunIcon.SetActive(true);
            swordIcon.SetActive(false);
        }
        Reload reloader          = weapons[index].GetComponent <Reload>();
        int    amountInInventory = reloader.roundsRemainingInInventory;
        int    amountInClip      = reloader.roundsRemainingInClip;

        ammoUI.text.text = string.Format("{0}/{1}", amountInClip, amountInInventory);
    }
Example #7
0
        new static void Main(string[] args)
        {
            AppBase.Program <AppSettings> .Main(args);

            Reload.Execute(ref AppSettings);

            while (true)
            {
                Console.Write("> ");
                var input = Console.ReadLine();
                var arg   = input.Contains(" ")
                    ? new string[] { input.Substring(0, input.IndexOf(" ")), input.Substring(input.IndexOf(" ") + 1) }
                    : new string[] { input };

                Parser.Default
                .ParseArguments <Login, CreateQuery, UpdateQuery, InsertQuery, DeleteQuery, Print, Reload, Exit>(arg)
                .MapResult(
                    (Login opts) => Login.Execute(ref AppSettings, ref Generator, opts),
                    (CreateQuery opts) => new CreateQuery().Execute(ref AppSettings, ref Generator, opts),
                    (UpdateQuery opts) => new UpdateQuery().Execute(ref AppSettings, ref Generator, opts),
                    (InsertQuery opts) => new InsertQuery().Execute(ref AppSettings, ref Generator, opts),
                    (DeleteQuery opts) => new DeleteQuery().Execute(ref AppSettings, ref Generator, opts),
                    (Print opts) => Print.Execute(ref AppSettings, opts),
                    (Reload opts) => Reload.Execute(ref AppSettings, opts),
                    (Exit opts) => Exit.Execute(opts),
                    errs => 1);

                if (arg.Length == 1 && arg[0] == "exit")
                {
                    break;
                }
            }

            Exit.Execute();
        }
Example #8
0
        public override void OnStart()
        {
            float delta = 0;

            jr = ((RangedWeapon)it).jerkShutter;
            re = ((RangedWeapon)it).reload;
            if (jr.chamberAmmo)
            {
                GameObject o = jr.chamberAmmo.gameObject;
                o.SetActive(true);
                o.transform.SetParent(visualisationBasis);
                o.transform.position = magazineBasis.position;
                GameManager.instance.TranslatePositionObject(o.transform, Vector3.zero, visualisationTimeDelta, GameManager.PositionTranslationObject.maxSpeedDefault, GameManager.PositionTranslationObject.errorDefault / 10, re.magazineAmmo.Length * visualisationTimeDelta);
                o.transform.rotation = Quaternion.LookRotation(visualisationBasis.forward);
                delta += visualisationPositionDelta;
            }
            for (int i = 0; i < re.magazineAmmo.Length; i++)
            {
                GameObject o = re.magazineAmmo[i]?.gameObject;
                if (!o)
                {
                    break;
                }
                o.SetActive(true);
                o.transform.SetParent(visualisationBasis);
                o.transform.position = magazineBasis.position;
                GameManager.instance.TranslatePositionObject(o.transform, -visualisationBasis.up * delta, visualisationTimeDelta, GameManager.PositionTranslationObject.maxSpeedDefault, GameManager.PositionTranslationObject.errorDefault / 10, (re.magazineAmmo.Length - i - 1) * visualisationTimeDelta);
                //o.transform.localPosition = (AmmoVisualisationPointTransform.position - magazineTransform.position).normalized * delta;
                o.transform.rotation = Quaternion.LookRotation(visualisationBasis.forward);
                delta += visualisationPositionDelta;
            }
        }
Example #9
0
        void OnApplicationActivated()
        {
            if (mException != null)
            {
                return;
            }

            Reload.IfWorkspaceConfigChanged(
                mPlasticAPI, mWkInfo, mIsGluonMode,
                ExecuteFullReload);

            if (mWkInfo == null)
            {
                return;
            }

            NewIncomingChanges.LaunchUpdater(
                mDeveloperNewIncomingChangesUpdater,
                mGluonNewIncomingChangesUpdater);

            if (mViewSwitcher != null)
            {
                mViewSwitcher.AutoRefreshPendingChangesView();
                mViewSwitcher.AutoRefreshIncomingChangesView();
            }
        }
        new static void Main(string[] args)
        {
            AppBase.Program <AppSettings> .Main(args);

            Reload.Execute(ref AppSettings);

            while (true)
            {
                Console.Write("> ");
                var arg = Console.ReadLine().Split(' ');

                Parser.Default
                .ParseArguments <Exit, Login, Run, Reload, Print>(arg)
                .MapResult(
                    (Login opts) => Login.Execute(ref AppSettings, ref Updater, opts),
                    (Run opts) => Run.Execute(ref AppSettings, ref Updater, opts),
                    (Reload opts) => Reload.Execute(ref AppSettings, opts),
                    (Print opts) => Print.Execute(ref AppSettings, opts),
                    (Exit opts) => Exit.Execute(opts),
                    errs => 1);

                if (arg.Length == 1 && arg[0] == "exit")
                {
                    break;
                }
            }

            Exit.Execute();
        }
Example #11
0
        private void MBtnAddUser_Click(object sender, EventArgs e)
        {
            if (!AddUserValidatorList.All(a => a.IsValid))
            {
                var InvalidValidatingControl = AddUserValidatorList.First(f => !f.IsValid);
                InvalidValidatingControl.ControlToValidate.Focus();

                return;
            }

            if (!mTxtAddPassword.Text.Equals(mTxtAddConfirmPassword.Text))
            {
                MessageBox.Show("Nhập lại mật khẩu không chính xác!");
                return;
            }

            UserAdd = new User
            {
                Username   = mTxtAddUsername.Text,
                Password   = mTxtAddPassword.Text,
                FirstName  = mTxtAddFirstName.Text,
                LastName   = mTxtAddLastName.Text,
                Dob        = mDateTimeAddDob.Value,
                Phone      = mTxtAddPhone.Text,
                Status     = true,
                RoleTypeId = (int)mCbAddRoleType.SelectedValue
            };

            AddUser?.Invoke(this, null);

            Reload?.Invoke(this, null);
        }
Example #12
0
 private void SPM_Connect_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Alt && e.KeyCode.ToString() == "A")
     {
         Reload.PerformClick();
     }
 }
Example #13
0
 public FrmDictDialog(Reload reLoad, string type)
 {
     Add    = true;
     reload = reLoad;
     InitializeComponent();
     txb_type.Text = type;
 }
Example #14
0
        private async void TasksTable_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            if (e.ColumnIndex != TasksTable.Columns["Delete"].Index &&
                e.ColumnIndex != TasksTable.Columns["Open"].Index)
            {
                return;
            }
            var active = TasksTable.CurrentRow;
            int id     = Int32.Parse(active.Cells["Id"].Value.ToString());

            if (e.ColumnIndex == TasksTable.Columns["Delete"].Index)
            {
                await RemoveTask?.Invoke(id);

                Reload?.Invoke();
            }
            else
            {
                OpenTask?.Invoke(id);
            }
        }
Example #15
0
 private void FileChanged_Handler(object o, FileSystemEventArgs e)
 {
     if (!_houston.InvokeRequired)
     {
         _fileWatch.EnableRaisingEvents = false;
         WriteToLog("input file updated by another application");
         //			MessageBox.Show("Another application has updated file " + _inputFile.Filename + "\nReload it?","Houston",MessageBoxButtons.YesNo);
         Reload reload = new Reload();
         reload.Question.Text = "Another application has updated file\n" + _inputFile.Filename + "\nReload it?";
         _houston.Enabled     = false;
         if (reload.ShowDialog(_houston) == DialogResult.Yes)
         {
             ReadData(e.FullPath);
             WriteToLog("input file update by other application applied");
         }
         else
         {
             WriteToLog("input file update by other application discarded");
             if (reload.undochanges.Checked)
             {
                 StreamWriter SW = new StreamWriter(_inputFile.Filename, false, System.Text.Encoding.ASCII);
                 SW.Write(_inputText);
                 SW.Close();
                 WriteToLog("input file on disk restored");
             }
         }
         _houston.Enabled = true;
         _fileWatch.EnableRaisingEvents = true;
     }
     else //We are on a non GUI thread.
     {
         _houston.Invoke(new FileChangedDelegate(FileChanged_Handler), new object[] { o, e });
     }
 }
Example #16
0
    // Start is called before the first frame update
    async void Start()
    {
        objectRenderer = GetComponent <Renderer>();
        await Task.Run(() => ListenEvents(source.Token));

        reloadX     = FindObjectOfType <Reload>();
        currentAmmo = maxAmmo; //set the starting ammo to max
    }
 public static void Register(Reload repository)
 {
     lock (FRepositories)
     {
         FRepositories.Add(repository);
     }
     repository();
 }
Example #18
0
        public FrmDictDialog(Reload reLoad, Sysdic cS)
        {
            Add    = false;
            reload = reLoad;
            cSDic  = cS;
            InitializeComponent();

            txb_type.Text = cS.Dicname;
        }
        /// <summary>
        /// Connect on startup if autoConnect is set to true.
        /// </summary>
        protected virtual void Start()
        {
            reloadX = FindObjectOfType <Reload>();   ///// This will find the script Reload attached to an object with int reload.

            if (autoConnect)
            {
                Connect();
            }
        }
 public void Recharge()
 {
     if (model.threadStart)
     {
         Reload r = new Reload();
         r.num = model.number;
         Writing(r);
     }
 }
Example #21
0
 public void Update()
 {
     if (inputController.mouseWheelDown || inputController.mouseWheelUp)
     {
         shoot    = hand.GetComponentInChildren <Shoot>();
         reloader = hand.GetComponentInChildren <Reload>();
         HandleOnAmmoChanged();
     }
 }
Example #22
0
        Task IEventHandler <OutcomeCreated> .HandleAsync(OutcomeCreated payload)
        {
            if (Key.IsEmpty || payload.CategoryKey.Equals(Key))
            {
                Reload?.Invoke();
            }

            return(Task.CompletedTask);
        }
Example #23
0
        private void ReloadGameButton_Click(object sender, RoutedEventArgs e)
        {
            BlockGroupBox.IsEnabled     = true;
            HitGroupBox.IsEnabled       = true;
            FightButton.IsEnabled       = true;
            ReloadGameButton.IsEnabled  = true;
            ReloadGameButton.Visibility = Visibility.Hidden;

            Reload?.Invoke(this, EventArgs.Empty);
        }
Example #24
0
        public Reload parseReloadJSON()
        {
            StreamReader fs     = File.OpenText(Properties.Settings.Default.ReloadJSONFilePath);
            string       JSON   = fs.ReadToEnd();
            Reload       reload = JsonConvert.DeserializeObject <Reload>(JSON);

            fs.Close();

            return(reload);
        }
Example #25
0
    // Any damage boosts go here

/*	protected Damage getDamage(){
 *              return Config.instance.damageFactory.getDamage(weapon, caster);
 *      }*/
    override public Action performPrepareAction(GameObject trg)
    {
        Action act;

        if (weapon.clip == 0)
        {
            act = new Reload();
            act.init(caster);
            return(makePrepareAction(act, trg, trg));
        }
        return(base.performPrepareAction(trg));
    }
    void Start()
    {
        theRigidbody2DProjectile = GetComponent <Rigidbody2D>();
        theSpringJoint2D         = GetComponent <SpringJoint2D>();
        theSpriteRenderer        = GetComponent <SpriteRenderer>();

        theGameManager       = GameObject.FindGameObjectWithTag("GM");
        theInstantiateScript = theGameManager.GetComponent <Instantiate>();
        theReloadScript      = theGameManager.GetComponent <Reload>();

        theSpringJoint2D.frequency = 5f;
    }
Example #27
0
    void shoot()
    {
        shootMax -= 1;
        Debug.Log("shoot");
        isCall = false;
        if (shootMax < 1)
        {
            isReload = true;
        }
        Reload reload = FindObjectOfType <Reload>();
        Skill  skill  = FindObjectOfType <Skill>();

        if (skill.ready)
        {
            GameObject KingPanel = Instantiate(skill.KingPanelPrefab, new Vector3(50, 0, 1), transform.rotation) as GameObject;
            skill.kingSkill = true;
            skill.ready     = false;
        }
        else
        {
            if (shootMax <= 0)
            {
                if (skill.kingSkill)
                {
                    isReload = false;
                    shootMax = Const.SHOOT_NUM;
                }
                else
                {
                    isReload = true;
                }
            }
            //Instantiate (ballPrefab, transform.position, Quaternion.identity);
            // 弾を生成
            Vector3 PlayerPos = transform.position;

            Vector3    ballPos = new Vector3(PlayerPos.x + movePos.x / 2f, PlayerPos.y + movePos.y / 2f, PlayerPos.z);
            GameObject shot    = Instantiate(ballPrefab, ballPos, transform.rotation) as GameObject;
            // Shotスクリプトオブジェクトを取得
            BallController s = shot.GetComponent <BallController>();

            //打つボールを取得(配列から1つ取り出す)
            int BallId = reload.ShootBall();

            s.ballType(BallId, charge, rot);

            //ボールのテクスチャを変更
            s.ChangeSprite(reload.BallSptite(BallId));
            //次に打つボールのセット
            reload.BallLoad();
        }
    }
Example #28
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(base.GetHashCode()
                + (Version.GetHashCode() * 3)
                + (Reload.GetHashCode() * 3)
                + (Update.GetHashCode() * 3)
                + (ConnectedClients.GetHashCode() * 3)
                + (ConnectedServers.GetHashCode() * 3)
                + (ConnectedAirports.GetHashCode() * 3) * 17);
     }
 }
Example #29
0
        private void Reload()
        {
            var command = new Reload();
            var context = GetContext();

            if (!command.CanExecute(context))
            {
                return;
            }

            AppHost.Usage.ReportCommand(command, context);
            command.Execute(context);
        }
    private void setUpGun()
    {
        m_ShootableMask = LayerMask.GetMask("Shootable");
        m_GunParticles  = GetComponent <ParticleSystem> ();

        m_GunAudio = GetComponent <AudioSource> ();
        m_GunLight = GetComponent <Light> ();

        m_GunAnimator = GetComponentInParent <Animator> ();

        m_Reload         = GetComponent <Reload> ();
        m_GunAudioSource = GetComponent <AudioSource> ();

        //       m_FirstPersonController = transform.parent.GetComponentInChildren<UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
    }