Beispiel #1
0
 protected void SettingAoeSizeByType(GameObject newAoeObject, AoeType type)
 {
     if (type == AoeType.Square)
     {
         newAoeObject.transform.localScale = new Vector3(xSize, 1, zSize);
     }
     if (type == AoeType.Circle)
     {
         newAoeObject.transform.localScale = new Vector3(diameter, newAoeObject.transform.localScale.y, diameter);
     }
 }
Beispiel #2
0
    public static IAreaOfEffect GetAOEByType(AoeType type)
    {
        switch (type)
        {
        case AoeType.Blast:
            return(new BlastAOE(Vector2.zero, 2));

        default:
            Debug.Log($"AoeType {type} not found. Using BlastAOE as default.");
            return(new BlastAOE());
        }
    }
Beispiel #3
0
    //通过传入的委托来判断当前的应该将哪些当做作用范围
    public virtual List <GameObject> GetTargetByCondition(Func <CharacterState, bool> func, float mCurDist, Transform target, AoeType aoeType = AoeType.CircleAoe)
    {
        List <GameObject> mTempMonsters = new List <GameObject>();

        Collider[] colliders = new Collider[] { };
        switch (aoeType)
        {
        case AoeType.CircleAoe:
            colliders = Physics.OverlapSphere(target.position, mCurDist + (CheckNeedAddDis() ? 0 : GameLibrary.Instance().GetExtendDis(mHitTargetCs)), layer);
            break;

        case AoeType.RectAoe:
            colliders = Physics.OverlapBox(target.position, new Vector3(mCurSkillNode.aoe_wide / 2, mCurSkillNode.aoe_long / 2, mCurSkillNode.aoe_long / 2 + GameLibrary.Instance().GetExtendDis(mHitTargetCs)), target.rotation, layer);
            break;

        default:
            break;
        }
        for (int i = 0; i < colliders.Length; i++)
        {
            CharacterState mCurTargetCs = colliders[i].GetComponent <CharacterState>();
            if (mCurTargetCs != null && func(mCurTargetCs) && CheckInView(mCurTargetCs, attackerCs))
            {
                mTempMonsters.Add(colliders[i].gameObject);
            }
        }
        return(mTempMonsters);
    }
Beispiel #4
0
 public static GameObject GetAoePrefabObject(AoeType aoeType)
 {
     return(dict[aoeType]);
 }