public void Tick(IHTNAgent npc, float deltaTime, float time)
        {
            ScientistAStarContext npcContext = npc.AiDomain.NpcContext as ScientistAStarContext;

            if (npcContext == null)
            {
                return;
            }
            npcContext.SetFact(Facts.HasNearbyCover, (npcContext.CoverPoints.Count > 0 ? 1 : 0), true, true, true);
            if (!npcContext.IsFact(Facts.HasEnemyTarget))
            {
                npcContext.ReserveCoverPoint(null);
                return;
            }
            HTNPlayer hTNPlayer = npc as HTNPlayer;

            if (hTNPlayer == null)
            {
                return;
            }
            float single  = 0f;
            float single1 = 0f;
            float single2 = 0f;

            foreach (CoverPoint coverPoint in npcContext.CoverPoints)
            {
                if (coverPoint.IsCompromised || coverPoint.IsReserved && !coverPoint.ReservedFor.EqualNetID(hTNPlayer))
                {
                    continue;
                }
                float single3 = -0.8f;
                BaseNpcMemory.EnemyPlayerInfo primaryKnownEnemyPlayer = npcContext.Memory.PrimaryKnownEnemyPlayer;
                if (!coverPoint.ProvidesCoverFromPoint(primaryKnownEnemyPlayer.LastKnownPosition, single3))
                {
                    continue;
                }
                Vector3 position          = coverPoint.Position - npc.BodyPosition;
                Vector3 lastKnownPosition = primaryKnownEnemyPlayer.LastKnownPosition - npc.BodyPosition;
                float   single4           = Vector3.Dot(position.normalized, lastKnownPosition.normalized);
                if (single < 1f)
                {
                    CoverPointsReasoner.EvaluateAdvancement(npc, npcContext, ref single, ref primaryKnownEnemyPlayer, coverPoint, position, lastKnownPosition, single4);
                }
                if (single2 < 1f)
                {
                    CoverPointsReasoner.EvaluateRetreat(npc, npcContext, ref single2, ref primaryKnownEnemyPlayer, coverPoint, position, lastKnownPosition, ref single4);
                }
                if (single1 >= 1f)
                {
                    continue;
                }
                CoverPointsReasoner.EvaluateFlanking(npc, npcContext, ref single1, ref primaryKnownEnemyPlayer, coverPoint, position, lastKnownPosition, single4);
            }
        }
        public void Tick(IHTNAgent npc, float deltaTime, float time)
        {
            ScientistAStarContext npcContext = npc.AiDomain.NpcContext as ScientistAStarContext;

            if (npcContext == null)
            {
                return;
            }
            npcContext.SetFact(Rust.Ai.HTN.ScientistAStar.Facts.HasNearbyCover, npcContext.CoverPoints.Count > 0 ? 1 : 0, true, true, true);
            if (!npcContext.IsFact(Rust.Ai.HTN.ScientistAStar.Facts.HasEnemyTarget))
            {
                npcContext.ReserveCoverPoint((CoverPoint)null);
            }
            else
            {
                HTNPlayer htnPlayer = npc as HTNPlayer;
                if (Object.op_Equality((Object)htnPlayer, (Object)null))
                {
                    return;
                }
                float bestScore1 = 0.0f;
                float bestScore2 = 0.0f;
                float bestScore3 = 0.0f;
                foreach (CoverPoint coverPoint in npcContext.CoverPoints)
                {
                    if (!coverPoint.IsCompromised && (!coverPoint.IsReserved || coverPoint.ReservedFor.EqualNetID((BaseNetworkable)htnPlayer)))
                    {
                        float arcThreshold = -0.8f;
                        BaseNpcMemory.EnemyPlayerInfo knownEnemyPlayer = npcContext.Memory.PrimaryKnownEnemyPlayer;
                        if (coverPoint.ProvidesCoverFromPoint(knownEnemyPlayer.LastKnownPosition, arcThreshold))
                        {
                            Vector3 dirCover   = Vector3.op_Subtraction(coverPoint.Position, npc.BodyPosition);
                            Vector3 dirDanger  = Vector3.op_Subtraction(knownEnemyPlayer.LastKnownPosition, npc.BodyPosition);
                            float   directness = Vector3.Dot(((Vector3) ref dirCover).get_normalized(), ((Vector3) ref dirDanger).get_normalized());
                            if ((double)bestScore1 < 1.0)
                            {
                                CoverPointsReasoner.EvaluateAdvancement(npc, npcContext, ref bestScore1, ref knownEnemyPlayer, coverPoint, dirCover, dirDanger, directness);
                            }
                            if ((double)bestScore3 < 1.0)
                            {
                                CoverPointsReasoner.EvaluateRetreat(npc, npcContext, ref bestScore3, ref knownEnemyPlayer, coverPoint, dirCover, dirDanger, ref directness);
                            }
                            if ((double)bestScore2 < 1.0)
                            {
                                CoverPointsReasoner.EvaluateFlanking(npc, npcContext, ref bestScore2, ref knownEnemyPlayer, coverPoint, dirCover, dirDanger, directness);
                            }
                        }
                    }
                }
            }
        }