コード例 #1
0
        private void GetFunctionKeyDown()
        {
            GetMousePosition();
            //Flip();
            _shootDirection.TurnTo();

            /*if (Input.GetKeyDown(SystemOption.ThrowAway))
             * {
             *  if (Gun != null)
             *  {
             *      GunThrowAway();
             *  }
             *
             * }*/
            if (Input.GetKeyDown(SystemOption.PreviousItem))
            {
                _bag.Now--;
                BagEdgeCheck();
                Debug.Log("现在是第" + (_bag.Now + 1) + "个道具:" + _bag.list[_bag.Now]);
            }
            else if (Input.GetKeyDown(SystemOption.NextItem))
            {
                _bag.Now++;
                BagEdgeCheck();
                Debug.Log("现在是第" + (_bag.Now + 1) + "个道具:" + _bag.list[_bag.Now]);
            }

            if (Input.GetKeyDown(SystemOption.PutDownItem))
            {
                _bag.Use(_state.name, this.transform.position, _muzzleOrientation);
            }
            CenterProcess.NotifyDashBoard();
        }
コード例 #2
0
        public void Hurt(float damage, String shootername, String guntype, Buff attackbuff = Buff.Normal) //收到伤害,参数依次为:收到伤害数值,伤害来源(单位),伤害来源(武器),伤害来源的Buff(默认是普通)
        {
            lock (_locker)                                                                                //本函数上进程锁,防止同时命中造成伤害计算混乱,强制依次计算
            {
                if (_isdead == false)                                                                     //如果是死亡状态则不进行伤害计算
                {
                    DamageCalculate(damage);                                                              //计算伤害
                    if (Health <= 0)                                                                      //血量小于0则进入死亡函数
                    {
                        Die(shootername, guntype);
                    }

                    BuffCheck(attackbuff);                                    //识别伤害来源的Buff,并更新全面板(受伤更新)
                    CenterProcess.NotifyDashBoard();

                    /*if (isAvatar == false && attackbuff!=Buff.Normal)
                     * {
                     *  _internalBuff = attackbuff;
                     *  BuffCheck();
                     *  CancelInvoke("InitBuff");
                     *  Invoke("InitBuff",time);
                     * }*/
                }
            }
        }