Exemplo n.º 1
0
 public static void RemoveFromInvestigateList(CAI AI)
 {
     if (m_List_Investigate.Contains(AI) == true)
     {
         m_List_Investigate.RemoveAt(m_List_Investigate.LastIndexOf(AI));
     }
 }
Exemplo n.º 2
0
        public async Task <IActionResult> Update([FromBody] CAI _cai)
        {
            CAI _Caiq = new CAI();

            try
            {
                _Caiq = (from c in _context.CAI
                         .Where(q => q.IdCAI == _cai.IdCAI)
                         select c
                         ).FirstOrDefault();

                _cai.FechaCreacion   = _Caiq.FechaCreacion;
                _cai.UsuarioCreacion = _Caiq.UsuarioCreacion;

                _context.Entry(_Caiq).CurrentValues.SetValues((_cai));
                // _context.CAI.Update(_Caiq);
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                return(BadRequest($"Ocurrio un error:{ex.Message}"));
            }

            return(await Task.Run(() => Ok(_Caiq)));
        }
Exemplo n.º 3
0
        public async Task <ActionResult <CAI> > Delete(Int64 IdCAI, CAI _CAIp)
        {
            CAI _CAI = _CAIp;

            try
            {
                string     baseadress = config.Value.urlbase;
                HttpClient _client    = new HttpClient();

                _client.DefaultRequestHeaders.Add("Authorization", "Bearer " + HttpContext.Session.GetString("token"));
                var result = await _client.PostAsJsonAsync(baseadress + "api/CAI/Delete", _CAI);

                string valorrespuesta = "";
                if (result.IsSuccessStatusCode)
                {
                    valorrespuesta = await(result.Content.ReadAsStringAsync());
                    _CAI           = JsonConvert.DeserializeObject <CAI>(valorrespuesta);
                }
            }
            catch (Exception ex)
            {
                return(BadRequest($"Ocurrio un error{ex.Message}"));
            }

            return(new ObjectResult(new DataSourceResult {
                Data = new[] { _CAI }, Total = 1
            }));
        }
Exemplo n.º 4
0
    void Initialize()
    {
        m_LayerMaskGround = CLayers.GetLayerMask_Ground();
        m_bGrounded       = Physics.CheckSphere(transform.position, 1.5f, m_LayerMaskGround);
        if (m_bGrounded == false)
        {
            print("Warning: " + gameObject.name + " isn't on the ground");
        }
        /////////RIGIDBODY/////////
        m_Rigidbody = GetComponent <Rigidbody>();
        m_fOrigDrag = GetRigidbody().drag;
        m_fOrigMass = GetRigidbody().mass;

        ///////////AI///////////
        m_Animator = GetComponent <Animator>();
        if (GetComponent <CAI>())
        {
            m_bIsAI = true;
            m_AI    = GetComponent <CAI>();
            GetAnimator().SetFloat("SpeedMultiplier", 1);
            GetRigidbody().mass = m_fMassNonKnockback;
        }
        else
        {
            m_bIsAI = false;
        }
    }
Exemplo n.º 5
0
        public async Task <ActionResult> GetCAIById([DataSourceRequest] DataSourceRequest request, [FromBody] CAI _CAI)
        {
            CAI _CertificadoDeposito = new CAI();

            try
            {
                string     baseadress = config.Value.urlbase;
                HttpClient _client    = new HttpClient();
                _client.DefaultRequestHeaders.Add("Authorization", "Bearer " + HttpContext.Session.GetString("token"));
                var result = await _client.GetAsync(baseadress + "api/CAI/GetCAIById/" + _CAI.IdCAI);

                string valorrespuesta = "";
                if (result.IsSuccessStatusCode)
                {
                    valorrespuesta       = await(result.Content.ReadAsStringAsync());
                    _CertificadoDeposito = JsonConvert.DeserializeObject <CAI>(valorrespuesta);
                }

                if (_CertificadoDeposito == null)
                {
                    _CertificadoDeposito = new CAI();
                }
            }
            catch (Exception ex)
            {
                _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                throw ex;
            }

            return(Json(_CertificadoDeposito));
        }
Exemplo n.º 6
0
 public static void RemoveFromCombatList(CAI AI)
 {
     if (m_List_Combat.Contains(AI) == true)
     {
         m_List_Combat.RemoveAt(m_List_Combat.LastIndexOf(AI));
     }
 }
Exemplo n.º 7
0
        //* -----------------------------------------------------------------------*
        /// <summary>1フレーム分の更新処理を実行します。</summary>
        ///
        /// <param name="entity">この状態を適用されているオブジェクト。</param>
        /// <param name="privateMembers">
        /// オブジェクトと状態クラスのみがアクセス可能なフィールド。
        /// </param>
        /// <param name="gameTime">前フレームが開始してからの経過時間。</param>
        public override void update(
            CAI <CInputDetector> entity, CInputCollection.CPrivateMembers privateMembers, GameTime gameTime
            )
        {
            CInputCollection collection = entity.owner;

            if (collection.Count == 0)
            {
                foreach (PlayerIndex playerIndex in CInputXBOX360.allPlayerIndex)
                {
                    GamePadState state = GamePad.GetState(playerIndex);
                    if (state.IsConnected && state.getPress() != 0)
                    {
                        collection.Add(CInputXBOX360.getInstance(
                                           playerIndex, collection.playerNumber));
                        break;
                    }
                }
            }
            if (collection.Count != 0)
            {
                setCapacity(collection);
                entity.nextState = CStateWait.instance;
            }
            base.update(entity, privateMembers, gameTime);
        }
Exemplo n.º 8
0
 public static void AddToCombatList(CAI AI)
 {
     if (m_List_Combat.Contains(AI) == false)
     {
         m_List_Combat.Add(AI);
         //CSoundBank.Instance.AIEnterCombat(AI.GetAIType(), AI.gameObject);
     }
 }
Exemplo n.º 9
0
 public static void AddToInvestigateList(CAI AI)
 {
     if (m_List_Investigate.Contains(AI) == false)
     {
         m_List_Investigate.Add(AI);
         CSoundBank.Instance.AIAlerted(AI.GetAIType(), AI.gameObject);
     }
 }
Exemplo n.º 10
0
        //* ────________________________________*
        //* methods ───────────────────────────────-*

        //* -----------------------------------------------------------------------*
        /// <summary>
        /// <para>状態が開始された時に呼び出されます。</para>
        /// <para>このメソッドは、遷移元の<c>teardown</c>よりも後に呼び出されます。</para>
        /// </summary>
        ///
        /// <param name="entity">この状態を適用されたオブジェクト。</param>
        /// <param name="privateMembers">
        /// オブジェクトと状態クラスのみがアクセス可能なフィールド。
        /// </param>
        public override void setup(CAI <CInputDetector> entity, CInputCollection.CPrivateMembers privateMembers)
        {
            CInputCollection collection = entity.owner;

            setCapacity(collection);
            collection.releaseAwayController = true;
            base.setup(entity, privateMembers);
        }
Exemplo n.º 11
0
 //AI calls it on death
 public static void RemoveAI_BothLists(CAI AI)
 {
     m_List_AllAI.Remove(AI);
     if (m_List_ActiveAI.Contains(AI))
     {
         m_List_ActiveAI.Remove(AI);
     }
 }
Exemplo n.º 12
0
        //* -----------------------------------------------------------------------*
        /// <summary>1フレーム分の更新処理を実行します。</summary>
        ///
        /// <param name="entity">この状態を適用されているオブジェクト。</param>
        /// <param name="privateMembers">
        /// オブジェクトと状態クラスのみがアクセス可能なフィールド。
        /// </param>
        /// <param name="gameTime">前フレームが開始してからの経過時間。</param>
        public override void update(CAI <CInputDetector> entity,
                                    CInputCollection.CPrivateMembers privateMembers, GameTime gameTime)
        {
            CInputCollection collection = entity.owner;

            if (collection.Count == 0)
            {
                entity.nextState = (CState <CAI <CInputDetector>, CInputCollection.CPrivateMembers>)
                                   entity.previousState;
            }
            base.update(entity, privateMembers, gameTime);
        }
Exemplo n.º 13
0
        //* ────________________________________*
        //* methods ───────────────────────────────-*

        //* -----------------------------------------------------------------------*
        /// <summary>
        /// <para>状態が開始された時に呼び出されます。</para>
        /// <para>このメソッドは、遷移元の<c>teardown</c>よりも後に呼び出されます。</para>
        /// </summary>
        ///
        /// <param name="entity">この状態を適用されたオブジェクト。</param>
        /// <param name="privateMembers">
        /// オブジェクトと状態クラスのみがアクセス可能なフィールド。
        /// </param>
        /// <exception cref="System.InvalidOperationException">
        /// 自動認識発動時に戻るべき状態が見つからない場合。
        /// </exception>
        public override void setup(
            CAI <CInputDetector> entity, CInputCollection.CPrivateMembers privateMembers)
        {
            Type type = entity.previousState.GetType();

            if (!(type == detectType || type.IsSubclassOf(detectType)))
            {
                throw new InvalidOperationException(
                          "戻るべき自動認識状態を見つけることができませんでした。");
            }
            base.setup(entity, privateMembers);
        }
Exemplo n.º 14
0
 //Update senses every few frames instead of every frame
 //add Time.deltaTime to a float every frame even if i don't update that frame.
 //This is to accumulate the correct values that will be used to multiply with, instead of Time.deltaTime
 void Start()
 {
     m_LayerMask         = ~CLayers.GetLayerMask_EnemyAndWeapon(); //layermask to ignore collisions with EnemyLayer and Weapon Layer
     m_AI                = GetComponent <CAI>();
     m_Player            = CPlayerControlls.GetPlayer();
     m_fCurrentSightCone = m_fNormalSightCone;
     if (m_Head == null)
     {
         print("Error: Variable m_Head of " + gameObject.name + " prefab was NULL!");
         m_Head = transform;
     }
 }
Exemplo n.º 15
0
        public async Task <ActionResult <CAI> > SaveCAI([FromBody] CAIDTO _CAIS)
        //public async Task<ActionResult<Product>> SaveProduct([FromBody]ProductDTO _ProductS)
        {
            CAI _CAI = _CAIS;

            try
            {
                // DTO_NumeracionSAR _liNumeracionSAR = new DTO_NumeracionSAR();
                string     baseadress = config.Value.urlbase;
                HttpClient _client    = new HttpClient();
                _client.DefaultRequestHeaders.Add("Authorization", "Bearer " + HttpContext.Session.GetString("token"));
                var result = await _client.GetAsync(baseadress + "api/CAI/GetCAIById/" + _CAI.IdCAI);

                string valorrespuesta = "";
                _CAI.FechaModificacion   = DateTime.Now;
                _CAI.UsuarioModificacion = HttpContext.Session.GetString("user");
                if (result.IsSuccessStatusCode)
                {
                    valorrespuesta = await(result.Content.ReadAsStringAsync());
                    _CAI           = JsonConvert.DeserializeObject <CAIDTO>(valorrespuesta);
                }

                if (_CAI == null)
                {
                    _CAI = new Models.CAI();
                }
                _CAIS._cai = _CAIS.elcai;
                if (_CAIS.IdCAI == 0)
                {
                    _CAI.FechaCreacion   = DateTime.Now;
                    _CAI.UsuarioCreacion = HttpContext.Session.GetString("user");
                    var insertresult = await Insert(_CAIS);
                }
                else
                {
                    _CAIS.UsuarioCreacion = _CAI.UsuarioCreacion;
                    _CAIS.FechaCreacion   = _CAI.FechaCreacion;
                    var updateresult = await Update(_CAI.IdCAI, _CAIS);
                }
            }
            catch (Exception ex)
            {
                _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                throw ex;
            }

            return(Json(_CAI));
        }
Exemplo n.º 16
0
        public async Task <IActionResult> GetCAIById(Int64 IdCai)
        {
            CAI Items = new CAI();

            try
            {
                Items = await _context.CAI.Where(q => q.IdCAI == IdCai).FirstOrDefaultAsync();
            }
            catch (Exception ex)
            {
                _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                return(BadRequest($"Ocurrio un error:{ex.Message}"));
            }


            return(await Task.Run(() => Ok(Items)));
        }
Exemplo n.º 17
0
        public async Task <IActionResult> Insert([FromBody] CAI _CAI)
        {
            CAI _CAIq = new CAI();

            try
            {
                _CAIq = _CAI;
                _context.CAI.Add(_CAIq);
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                return(BadRequest($"Ocurrio un error:{ex.Message}"));
            }

            return(await Task.Run(() => Ok(_CAI)));
        }
Exemplo n.º 18
0
        public async Task <IActionResult> Delete([FromBody] CAI _cai)
        {
            CAI _caiq = new CAI();

            try
            {
                _caiq = _context.CAI
                        .Where(x => x.IdCAI == (int)_cai.IdCAI)
                        .FirstOrDefault();
                _context.CAI.Remove(_caiq);
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                return(BadRequest($"Ocurrio un error:{ex.Message}"));
            }

            return(await Task.Run(() => Ok(_caiq)));
        }
Exemplo n.º 19
0
        //* -----------------------------------------------------------------------*
        /// <summary>1フレーム分の更新処理を実行します。</summary>
        ///
        /// <param name="entity">この状態を適用されているオブジェクト。</param>
        /// <param name="privateMembers">
        /// オブジェクトと状態クラスのみがアクセス可能なフィールド。
        /// </param>
        /// <param name="gameTime">前フレームが開始してからの経過時間。</param>
        public override void update(
            CAI <CInputDetector> entity, CInputCollection.CPrivateMembers privateMembers, GameTime gameTime
            )
        {
            CInputCollection collection = entity.owner;

            if (collection.Count == 0)
            {
                CInputLegacy input = instanceList.FirstOrDefault(
                    item => item.isPushAnyKey(detectPOV, detectSlider));
                if (input != null)
                {
                    collection.Add(input);
                }
            }
            if (collection.Count != 0)
            {
                setCapacity(collection);
                entity.nextState = CStateWait.instance;
            }
            base.update(entity, privateMembers, gameTime);
        }
Exemplo n.º 20
0
        public override void AI()
        {
            Lighting.AddLight(projectile.Center, 0.45f, 0f, 0.5f);

            CAI.LightningAI(projectile, ref projectile.ai, ref projectile.localAI, 74);
        }
Exemplo n.º 21
0
 //* -----------------------------------------------------------------------*
 /// <summary>コンストラクタ。</summary>
 ///
 /// <param name="playerNumber">プレイヤー番号。</param>
 /// <param name="firstState">初期状態。</param>
 /// <param name="aiState">自動認識状態。</param>
 public CInputDetector(short playerNumber, IState firstState, IState aiState)
     : base(playerNumber, firstState)
 {
     ai = new CAI <CInputDetector>(this, aiState);
 }
Exemplo n.º 22
0
        //* ────────────-_______________________*
        //* constructor & destructor ───────────────────────*

        //* -----------------------------------------------------------------------*
        /// <summary>コンストラクタ。</summary>
        private CCursor()
            : base(CStateCursor.instance)
        {
            locate = Vector2.Zero;
            aiView = new CAI <CCursor>(this, CStateVisible.instance);
        }
Exemplo n.º 23
0
 public static void AddAI_ActiveAIList(CAI AI)
 {
     m_List_ActiveAI.Add(AI);
 }