コード例 #1
0
 public static float BM_Vigilance_Search(AIEntity pEntity)
 {
     if (pEntity.GetComponent <getPlayer> ().search)
     {
         return(1.0f);
     }
     return(0.0f);
 }
コード例 #2
0
 public static float Rest2Round(AIEntity pSponsor, AIEntity[] pResponsers, int pid)
 {
     if (pSponsor.GetComponent <trapAI> ().rest == false)
     {
         return(1.0f);
     }
     return(0.0f);
 }
コード例 #3
0
 public static float BM_Crazyrun_Delay(AIEntity pEntity)
 {
     if (pEntity.GetComponent <bombAI> ().arrive)
     {
         return(1.0f);
     }
     return(0.0f);
 }
コード例 #4
0
 public static float Vigilance2Search(AIEntity pSponsor, AIEntity[] pResponsers, int pid)
 {
     if (pSponsor.GetComponent <getPlayer> ().search)
     {
         return(1.0f);
     }
     return(0.0f);
 }
コード例 #5
0
 public static float Rest2Vigilance(AIEntity pSponsor, AIEntity[] pResponsers, int pid)
 {
     if (pSponsor.GetComponent <getPlayer> ().insight)
     {
         return(1.0f);
     }
     return(0.0f);
 }
コード例 #6
0
 public static float Search2Engage(AIEntity pSponsor, AIEntity[] pResponsers, int pid)
 {
     if (pSponsor.GetComponent <getPlayer> ().engage)
     {
         return(1.0f);
     }
     return(0.0f);
 }
コード例 #7
0
 public static float Serach2Round(AIEntity pSponsor, AIEntity[] pResponsers, int pid)
 {
     if (pSponsor.GetComponent <getPlayer> ().search)
     {
         return(0.0f);
     }
     return(1.0f);
 }
コード例 #8
0
 public static float SM_Vigilance_Round(AIEntity pEntity)
 {
     if (pEntity.GetComponent <getPlayer> ().vigilance)
     {
         return(0.0f);
     }
     return(1.0f);
 }
コード例 #9
0
 public static float SM_Round_Vigilance(AIEntity pEntity)
 {
     if (pEntity.GetComponent <getPlayer> ().insight)
     {
         return(1.0f);
     }
     return(0.0f);
 }
コード例 #10
0
 public static float SM_Search_Round(AIEntity pEntity)
 {
     if (pEntity.GetComponent <getPlayer> ().search)
     {
         return(0.0f);
     }
     return(1.0f);
 }
コード例 #11
0
    // 通用结束

    public static float TM_Wary_Findcover(AIEntity pEntity)
    {
        if (pEntity.GetComponent <trapAI> ().waryFinish)
        {
            return(0.8f);   // 休息够了,进入寻找掩体的概率就更大了
        }
        return(0.2f);       // 本宝宝还没休息够
    }
コード例 #12
0
 public static float Round2Return(AIEntity pSponsor, AIEntity[] pResponsers, int pid)
 {
     if (pSponsor.GetComponent <Group4StandardAI> ().formAgain < 0.0f)
     {
         return(1.0f);
     }
     return(0.0f);
 }
コード例 #13
0
 public static float DeathAction(AIEntity pEntity)
 {
     if (pEntity.GetComponent <SSHComponent> ().HPNow < 10)
     {
         return(0.9f);
     }
     return(0.0f);
 }
コード例 #14
0
 // 行为节点应该可以直接复用SM4中的前半部分(不行...在方法里,组件是不同的,需要进行的设置也不同...),关于Engage节点,单独设计
 // 所有人员组成队形位置
 public static void Return_Enter(AIEntity pSponsor, AIEntity[] pResponsers, int pid)
 {
     // 使自己先停下来
     if (pid == 0)
     {
         Debug.Log("SM3TM1 Return");
     }
     if (pid == 0)
     {
         pSponsor.GetComponent <AIMove> ().mVelocity             = 0.0f;
         pSponsor.GetComponent <Group4StandardAI> ().readyReturn = 0;
         pSponsor.GetComponent <Group4StandardAI> ().returnTime  = 10.0f;
         // 分配每个人的位置
         GameObject ai = pSponsor.GetComponent <BaseAIComponent> ().mAIRT;
         pSponsor.GetComponent <Group4StandardAI> ().target [0] = ai.transform.position + ai.transform.forward.normalized * 1.0f;
         pSponsor.GetComponent <Group4StandardAI> ().target [1] = ai.transform.position + ai.transform.forward.normalized * 0.5f +
                                                                  pSponsor.mAI.transform.right.normalized * 0.5f;
         pSponsor.GetComponent <Group4StandardAI> ().target [2] = ai.transform.position + ai.transform.forward.normalized * 0.5f -
                                                                  pSponsor.mAI.transform.right.normalized * 0.5f;
     }
     else
     {
         pResponsers [pid - 1].GetComponent <AIMove> ().mVelocity  = 0.0f;
         pResponsers [pid - 1].GetComponent <SSHComponent> ().back = true;
     }
 }
コード例 #15
0
ファイル: GroupSM4.cs プロジェクト: TianYiJT/FreedomAI
    // 组行为节点

    // 所有人员组成队形位置
    public static void Return_Enter(AIEntity pSponsor, AIEntity[] pResponsers, int pid)
    {
        // 使自己先停下来
        if (pid == 0)
        {
            Debug.Log("SM4 Return");
        }
        if (pid == 0)
        {
            pSponsor.GetComponent <AIMove> ().mVelocity             = 0.0f;
            pSponsor.GetComponent <Group4StandardAI> ().readyReturn = 0;
            pSponsor.GetComponent <Group4StandardAI> ().returnTime  = 10.0f;
            pSponsor.GetComponent <Group4StandardAI> ().target [0]  = pSponsor.AIPos + pSponsor.mAI.transform.forward.normalized * 1f;
            pSponsor.GetComponent <Group4StandardAI> ().target [1]  = pSponsor.AIPos + pSponsor.mAI.transform.forward.normalized * 0.5f -
                                                                      pSponsor.mAI.transform.right.normalized * 0.5f;
            pSponsor.GetComponent <Group4StandardAI> ().target [2] = pSponsor.AIPos + pSponsor.mAI.transform.forward.normalized * 0.5f +
                                                                     pSponsor.mAI.transform.right.normalized * 0.5f;
            pSponsor.GetComponent <SSHComponent> ().back = true;
        }
        else
        {
            pResponsers [pid - 1].GetComponent <AIMove> ().mVelocity  = 0.0f;
            pResponsers [pid - 1].GetComponent <SSHComponent> ().back = true;
        }
    }
コード例 #16
0
    // 寻找掩体
    // 先判断有没有掩体,那么就跑向下一个掩体点,中途判断是否进入掩体
    public static void TM_Findcover_Enter(AIEntity pEntity)
    {
//		Debug.Log ("TMFindcover");
        pEntity.GetComponent <trapAI> ().runTime = 3.0f;
        // 进入这个状态,(1)就是没有掩体(2)玩家太近,舍弃掩体
        pEntity.GetComponent <trapAI> ().covered = false;
        Vector3    pA   = pEntity.GetComponent <trapAI> ().coverPosA;
        Vector3    pB   = pEntity.GetComponent <trapAI> ().coverPosB;
        Ray        rayA = new Ray(pA, pEntity.PlayerPos - pA);
        Ray        rayB = new Ray(pB, pEntity.PlayerPos - pB);
        RaycastHit hit;
        //只和障碍物层(对于敌人来说,玩家和障碍物都算是障碍物层)进行判断,并且设置距离为20
        int targetMask = LayerMask.GetMask("Barrier");

        if (Physics.Raycast(rayA, out hit, 20.0f, targetMask))
        {
            // 意味着A点是可以的
            pEntity.GetComponent <trapAI> ().coverNow = pA;
//			Debug.Log ("isA");
            return;
        }
        else if (Physics.Raycast(rayB, out hit, 20.0f, targetMask))
        {
            pEntity.GetComponent <trapAI> ().coverNow = pB;
//			Debug.Log ("isB");
            return;
        }
        else
        {
            // 两个点都不行绝望...设置为初始值,这表示了,现在只要逃离玩家即可
            Vector3 dis = (pEntity.AIPos - pEntity.PlayerPos).normalized;
            pEntity.GetComponent <trapAI> ().coverNow = pEntity.PlayerPos + 10.0f * dis;
        }
    }
コード例 #17
0
 public static void Rest_Enter(AIEntity pSponsor, AIEntity[] pResponsers, int pid)
 {
     if (pid == 0)
     {
         Debug.Log("SM3TM1 Rest");
     }
     if (pid == 0)
     {
         pSponsor.GetComponent <trapAI> ().restTime  = pSponsor.GetComponent <trapAI> ().rtintit;
         pSponsor.GetComponent <trapAI> ().rest      = true;
         pSponsor.GetComponent <AIMove> ().mVelocity = 0.0f;
     }
     else
     {
         pResponsers [pid - 1].GetComponent <AIMove> ().mVelocity  = 0.0f;
         pResponsers [pid - 1].GetComponent <SSHComponent> ().back = true;
     }
 }
コード例 #18
0
    // 攻击状态机,持盾接近到持盾静止
    public static float SM_ShieldF_ShieldS(AIEntity pEntity)
    {
        float staNow    = pEntity.GetComponent <staComponent> ().staNow;
        float staAttack = pEntity.GetComponent <staComponent> ().staAttack;
        float staMax    = pEntity.GetComponent <staComponent> ().staMax;
        float dis       = Vector3.Distance(pEntity.AIPos, pEntity.PlayerPos);

        if (staNow / staMax < 0.1f)        // 当耐力值过低时,休息一下
        {
            return(1.0f);
        }
        if (dis > 0.5f)
        {
            return(0.0f);           //距离不在攻击范围内,不可停止
        }
        // 距离也够近了,耐力值也够多了
        return(1.0f);
    }
コード例 #19
0
 public static float IdleAction(AIEntity pEntity)
 {
     // 没有使用特殊攻击,且距离过远
     if (pEntity.GetComponent <shieldAI> ().powerEnd)
     {
         return(0.5f);
     }
     return(0.0f);
 }
コード例 #20
0
 public static float TM_Barrier_Findcover(AIEntity pEntity)
 {
     // 没有携带掩体直接进入
     if (pEntity.GetComponent <trapAI> ().barrierHave == false)
     {
         return(1.0f);
     }
     return(0.0f);
 }
コード例 #21
0
 public static float SM_Attack_ShieldS(AIEntity pEntity)
 {
     // 播完动画进入停止
     if (pEntity.GetComponent <shieldAI> ().attackfinish)
     {
         return(1.0f);
     }
     return(0.0f);
 }
コード例 #22
0
ファイル: GroupSM4.cs プロジェクト: TianYiJT/FreedomAI
    public static float ShieldF2Chase(AIEntity pSponsor, AIEntity[] pResponsers, int pid)
    {
        //其实就是逆向路径函数的取反加1(实际情况会很鬼畜...所以要将他们的值设置的有些许不同)
        //使用20.0f作为判断阈值
        float dis = Vector3.Distance(pSponsor.AIPos, pSponsor.PlayerPos);

        if (dis < 10.0f)
        {
            return(0.0f);           //距离过近,需持盾
        }
        float sta = pSponsor.GetComponent <staComponent> ().staNow / pSponsor.GetComponent <staComponent> ().staMax;

        if (sta > 0.3f)
        {
            return(1.0f);           //精力充足,可以跑步接近
        }
        return(0.0f);
    }
コード例 #23
0
 public static float TM_Fire_Findcover(AIEntity pEntity)
 {
     // 射击完就转换
     if (pEntity.GetComponent <trapAI> ().fired)
     {
         return(1.0f);
     }
     return(0.0f);
 }
コード例 #24
0
 public static float DoomAction(AIEntity pEntity)
 {
     // 处于交战状态
     if (pEntity.GetComponent <getPlayer> ().engage)
     {
         return(0.7f);
     }
     return(0.0f);
 }
コード例 #25
0
 public static float SM_Rest_Round(AIEntity pEntity)
 {
     // 休息够了
     if (pEntity.GetComponent <shieldAI> ().rest == false)
     {
         return(1.0f);
     }
     return(0.0f);
 }
コード例 #26
0
 public static float DeathAction(AIEntity pEntity)
 {
     // 被杀死(记住,自爆延迟后,生命值自动归0)
     if (pEntity.GetComponent <bombAI> ().HPNow < 10)
     {
         return(1.0f);
     }
     return(0.0f);
 }
コード例 #27
0
    // 有趣的是,死亡时,必定自爆的...
    public static void BM_Boom_Enter(AIEntity pEntity)
    {
        //Debug.Log ("Boom");
        Transform  p    = pEntity.mPlayer.transform;
        Transform  a    = pEntity.GetComponent <BaseAIComponent> ().mAIRT.transform;
        Ray        rayh = new Ray(a.position + Vector3.up * 0.8f, p.position - a.position + Vector3.up * 0.8f);
        Ray        rayl = new Ray(a.position + Vector3.up * 0.5f, p.position - a.position + Vector3.up * 0.5f);
        RaycastHit hit;
        int        targetMask = LayerMask.GetMask("Barrier");

        if (Physics.Raycast(rayh, out hit, pEntity.GetComponent <getPlayer> ().sightRange, targetMask) &&
            Physics.Raycast(rayl, out hit, pEntity.GetComponent <getPlayer> ().sightRange, targetMask))
        {
            // 只有两个视点都被障碍物挡住了,才是没炸到玩家
            pEntity.mPlayer.GetComponent <HPComponent> ().tempHP -= pEntity.GetComponent <bombAI> ().damage;
            //Debug.Log ("bombdamage!");
        }
    }
コード例 #28
0
 public static float BM_Rest_Vigilance(AIEntity pEntity)
 {
     //Debug.Log (pEntity.ToString());
     if (pEntity.GetComponent <getPlayer> ().insight)
     {
         return(1.0f);
     }
     return(0.0f);
 }
コード例 #29
0
 public static void Round_Enter(AIEntity pSponsor, AIEntity[] pResponsers, int pid)
 {
     // 以领导者为基准
     if (pid == 0)
     {
         Debug.Log("SM3TM1 Round");
     }
     if (pid == 0)
     {
         pSponsor.GetComponent <trapAI> ().tempRoundPoint      = Vector3.zero;
         pSponsor.GetComponent <trapAI> ().tiredTime           = pSponsor.GetComponent <trapAI> ().ttinit;
         pSponsor.GetComponent <Group4StandardAI> ().formAgain = 20.0f;
     }
     else
     {
         pResponsers [pid - 1].GetComponent <SSHComponent> ().back = true;
     }
 }
コード例 #30
0
    public static void TM_Trap(AIEntity pEntity)
    {
        if (pEntity.GetComponent <trapComponent> ().trapNow == 0)
        {
            return;
        }
        // 设置陷阱球的终止位置,设置为从陷阱师出发一段距离
        Vector3    dir      = pEntity.AIPos - pEntity.PlayerPos;
        GameObject trapBall = GameObject.Instantiate(pEntity.GetComponent <trapAI> ().trapBallObj,
                                                     pEntity.AIPos + Vector3.up * 1.0f, pEntity.GetComponent <BaseAIComponent> ().mAIRT.transform.rotation);

        //设置最终位置为陷阱师和玩家之间的一个位置
        trapBall.GetComponent <TrapBallController> ().endPos = pEntity.PlayerPos + dir * 0.3f;
        trapBall.GetComponent <TrapBallController> ().active = true;

        //各种操作...需要补全
        pEntity.GetComponent <trapComponent> ().trapNow = 0;
    }