예제 #1
0
        public override void Initialize(AICharacterBrain _Brain)
        {
            base.Initialize(_Brain);
            m_learnedBehaviorManager.m_baseMoveManager.m_NavMeshAgent.speed = _Brain.m_BaseMoveManager.m_RunSpeed;

            pursuitTatget = _Brain.m_SensorManager.m_SensorData.m_EnemyTarget.transform;
        }
예제 #2
0
 public override void Initialize(AICharacterBrain _Brain)
 {
     base.Initialize(_Brain);
     m_Animator.SetFloat("Speed", 0);
     //m_brain.m_BaseMoveManager.m_NavMeshAgent.speed = 0.01f;
     _Brain.m_BaseMoveManager.ChangeMoveTarget(_Brain.m_CurrentTransform);
 }
예제 #3
0
 private bool FarAwayEnoughFormEvadeTarget(AICharacterBrain _brain)
 {
     if ((_brain.m_CurrentTransform.position - _brain.m_SensorManager.m_SensorData.m_EvadeTarget.transform.position).sqrMagnitude >= farAwayEnoughDistance * farAwayEnoughDistance)
     {
         return(true);
     }
     return(false);
 }
예제 #4
0
 public override bool MatchedChangeCondition(AICharacterBrain _Brain)
 {
     if (_Brain.m_SensorManager.m_SensorData.m_HaveEnemy)
     {
         return(true);
     }
     return(false);
 }
예제 #5
0
 public override void Initialize(AICharacterBrain _Brain)
 {
     base.Initialize(_Brain);
     _Brain.m_BaseMoveManager.ChangeMoveTarget(_Brain.m_CurrentTransform);
     m_Animator.SetFloat("Speed", 0);
     m_Animator.SetTrigger(m_Skill);
     SetTimeLag();
 }
예제 #6
0
 public void Initialize(AICharacterBrain _Brain)
 {
     brain      = _Brain;
     aiSettings = _Brain.GetComponent <AISettings>();
     if (aiSettings.m_SurfaceConscious)
     {
         m_AISurfaceConscious.Initialize(brain);
     }
 }
예제 #7
0
 public override bool MatchedChangeCondition(AICharacterBrain _Brain)
 {
     if (_Brain.m_SensorManager.m_SensorData.m_NeedEvade)
     {
         //Debug.Log("Need Evade");
         return(true);
     }
     return(false);
 }
예제 #8
0
        public void InitializeDictionary(AICharacterBrain _Brain)
        {
            aiSetting = _Brain.GetComponent <AISettings>();

            //将所有用户设置的关系加入dictionary
            //Debug.Log(aiSetting.m_PreSetAcquaintanceInfo.Count);
            for (int i = 0; i < aiSetting.m_PreSetAcquaintanceInfo.Count; i++)
            {
                m_Acquaintance.Add(aiSetting.m_PreSetAcquaintanceInfo[i].PreSetObject.name, aiSetting.m_PreSetAcquaintanceInfo[i].PreSetRelationship);
            }
        }
예제 #9
0
 // Use this for initialization
 protected virtual void Start()
 {
     brain          = GetComponent <AICharacterBrain>();
     sensorData     = brain.m_SensorManager.m_SensorData;
     neighbors      = sensorData.m_Neighbors;
     peopleInMemory = brain.m_AIMemory.m_Acquaintance;
     if (stateText)
     {
         StartCoroutine(ShowState());
     }
 }
예제 #10
0
 /// <summary>
 /// 判断当前邻居是否是敌人,一次只有一个敌人
 /// judge if current neighbors are enemy
 /// </summary>
 /// <param name="_Brain"></param>
 public void JudgeIfNeighborIsEnemy(AICharacterBrain _Brain)
 {
     brain = _Brain;
     for (int i = 0; i < brain.m_SensorManager.m_SensorData.m_Neighbors.Count; i++)
     {
         if (brain.m_AIMemory.m_Acquaintance[brain.m_SensorManager.m_SensorData.m_Neighbors[i].name] == AISettings.RelationShip.Hate)
         {
             brain.m_SensorManager.m_SensorData.m_HaveEnemy   = true;
             brain.m_SensorManager.m_SensorData.m_EnemyTarget = brain.m_SensorManager.m_SensorData.m_Neighbors[i];
             return;
         }
     }
 }
예제 #11
0
 public void JudgeIfNeighborIsWhoIFear(AICharacterBrain _Brain)
 {
     brain = _Brain;
     for (int i = 0; i < brain.m_SensorManager.m_SensorData.m_Neighbors.Count; i++)
     {
         if (brain.m_AIMemory.m_Acquaintance[brain.m_SensorManager.m_SensorData.m_Neighbors[i].name] == AISettings.RelationShip.Fear)
         {
             brain.m_SensorManager.m_SensorData.m_NeedEvade   = true;
             brain.m_SensorManager.m_SensorData.m_EvadeTarget = brain.m_SensorManager.m_SensorData.m_Neighbors[i];
             return;
         }
     }
 }
예제 #12
0
        public override bool MatchedChangeCondition(AICharacterBrain _Brain)
        {
            animator            = _Brain.GetComponent <Animator>();
            animStateInfomation = animator.GetCurrentAnimatorStateInfo(0);
            for (int i = 0; i < matchAnimatorName.Length; i++)
            {
                if (animStateInfomation.IsName(matchAnimatorName[i]))
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #13
0
        public override bool MatchedChangeCondition(AICharacterBrain _Brain)
        {
            if (_Brain.m_SensorManager.m_SensorData.m_HaveEnemy)
            {
                float distanceBetweenEnemyAndAI = (_Brain.m_CurrentTransform.transform.position - _Brain.m_SensorManager.m_SensorData.m_EnemyTarget.transform.position).sqrMagnitude;
                if (distanceBetweenEnemyAndAI <= arrivedDistance * arrivedDistance)
                {
                    // Debug.Log("Arrived Target" + _Brain.m_BaseMoveManager.m_NavMeshAgent.remainingDistance);
                    return(true);
                }
            }

            return(false);
        }
예제 #14
0
        //private LearnedBehavior currentLearnedBehavior;//当前决定所对应的学习性行为

        /// <summary>
        /// 初始化LearnedBehaviorManager
        /// </summary>
        /// <param name="_Brain">传入的AIbrain</param>
        public void Initialize(AICharacterBrain _Brain)
        {
            brain      = _Brain;
            aiSettings = _Brain.GetComponent <AISettings>();
            // Debug.Log(aiSettings.m_PatrolPlace[0].position);
            baseMoveManager = _Brain.m_BaseMoveManager;
            for (int i = 0; i < aiSettings.m_PatrolPlace.Count; i++)
            {
                if (aiSettings.m_PatrolPlace[i] != null)
                {
                    m_PatrolTargets.Add(aiSettings.m_PatrolPlace[i].position);
                }
            }
            InitializeDecision();
        }
예제 #15
0
 /// <summary>
 /// 初始化patrol
 /// </summary>
 /// <param name="_learnedBehaviorManager"></param>
 public override void Initialize(AICharacterBrain _Brain)
 {
     base.Initialize(_Brain);
     //Debug.Log("in here");
     //Debug.Log(_learnedBehaviorManager.m_PatrolTargets.Count);
     //Debug.Log(patrolTarget.Length);
     m_learnedBehaviorManager.m_baseMoveManager.m_NavMeshAgent.speed = _Brain.m_BaseMoveManager.m_WalkSpeed;
     timeLag = timeLagRecorder;
     for (int i = 0; i < m_learnedBehaviorManager.m_PatrolTargets.Count; i++)
     {
         //Debug.Log(m_learnedBehaviorManager.m_PatrolTargets[i]);
         patrolQueue.Enqueue(m_learnedBehaviorManager.m_PatrolTargets[i]);
     }
     //Debug.Log(patrolQueue.Count);
     m_Animator.SetFloat("Speed", 1);
 }
예제 #16
0
        // Use this for initialization
        void Start()
        {
            brain         = GetComponent <AICharacterBrain>();
            aiSettings    = GetComponent <AISettings>();
            originalPlace = new Vector3(m_CurrentTransform.position.x, m_CurrentTransform.position.y, m_CurrentTransform.position.z);

            if (aiSettings.m_PreSetAcquaintanceInfo.Count == 0)
            {
                aiSettings.m_PreSetAcquaintanceInfo.Add(aiSettings.CreatePreSetAcquaintanceInfo(GameObject.FindGameObjectWithTag("Player"), AISettings.RelationShip.Hate));
                //Debug.Log(aiSettings.m_PreSetAcquaintanceInfo[0].PreSetObject + " " + aiSettings.m_PreSetAcquaintanceInfo[0].PreSetRelationship);
            }
            //anim = GetComponent<Animator>();
            delayTimer       = aiSettings.m_DelayTimer;
            recordDelayTimer = aiSettings.m_DelayTimer;

            InitializeProperty();
        }
예제 #17
0
 public override bool MatchedChangeCondition(AICharacterBrain _Brain)
 {
     animator            = _Brain.GetComponent <Animator>();
     animStateInfomation = animator.GetCurrentAnimatorStateInfo(0);
     if ((_Brain.m_SensorManager.M_GetCurrentEnemyTarget().transform.position - _Brain.m_CurrentTransform.position).sqrMagnitude > farAwayDistance * farAwayDistance)
     {
         bool _flagOfMove = true;
         for (int i = 0; i < matchAnimatorName.Length; i++)
         {
             if ((animStateInfomation.IsName(matchAnimatorName[i])))
             {
                 _flagOfMove = false;
                 break;
             }
         }
         if (_flagOfMove)
         {
             return(true);
         }
     }
     return(false);
 }
예제 #18
0
 public override void InitializeSensor(AICharacterBrain _Brain)
 {
     brain      = _Brain;
     aiSettings = _Brain.GetComponent <AISettings>();
 }
예제 #19
0
 /// <summary>
 /// 用于传入参数
 /// </summary>
 /// <param name="_Brain">接收外部传入的aicharacterBrain </param>
 public void Initialize(AICharacterBrain _Brain)
 {
     brain        = _Brain;
     navMeshAgent = brain.GetComponent <NavMeshAgent>();
 }
예제 #20
0
        private NextDecision[] nextDecision;//将会有些什么决定

        /// <summary>
        /// 初始化决定以及相对应的学习性行为
        /// </summary>
        /// <param name="_Brain"></param>
        public void Initialize(AICharacterBrain _Brain)
        {
            learnedBehavior = Instantiate(learnedBehavior);
            learnedBehavior.Initialize(_Brain);
        }
예제 #21
0
 public override void Initialize(AICharacterBrain _Brain)
 {
     base.Initialize(_Brain);
     timeLag = 2f;
     m_Animator.SetFloat("Speed", 2);
 }
예제 #22
0
 public virtual bool MatchedChangeCondition(AICharacterBrain _Brain)
 {
     return(false);
 }
예제 #23
0
 public virtual void Initialize(AICharacterBrain _Brain)
 {
     m_brain    = _Brain;
     m_Animator = _Brain.GetComponent <Animator>();
     m_learnedBehaviorManager = _Brain.m_LearnedBehaviorManager;
 }
예제 #24
0
파일: Evade.cs 프로젝트: zheminggu/Game-AI
 private Vector3 evadePosition = new Vector3(); //逃离到的地点
 public override void Initialize(AICharacterBrain _Brain)
 {
     base.Initialize(_Brain);
     evadeTarget = _Brain.m_SensorManager.M_GetCurrentEvadeTarget().transform;
 }
예제 #25
0
 public virtual void Initialize(AICharacterBrain _Brain)
 {
     m_brain = _Brain;
 }
예제 #26
0
 public override bool MatchedChangeCondition(AICharacterBrain _Brain)
 {
     return(false);
 }
예제 #27
0
 public override void Initialize(AICharacterBrain _Brain)
 {
     base.Initialize(_Brain);
 }
예제 #28
0
 public override bool MatchedChangeCondition(AICharacterBrain _Brain)
 {
     return(FarAwayEnoughFormEvadeTarget(_Brain));
 }
예제 #29
0
 public virtual void InitializeSensor(AICharacterBrain _Brain)
 {
 }