コード例 #1
0
    private GameObject GetTarget(Card.CastType type)
    {
        if (targetType == TargetType.Nearest)
        {
            return(GetNearest(type));
        }
        else if (targetType == TargetType.Furthest)
        {
            return(GetFurthest(type));
        }
        else if (targetType == TargetType.HighestShield)
        {
            return(GetHighestShield(type));
        }
        else if (targetType == TargetType.LowestShield)
        {
            return(GetLowestShield(type));
        }
        else if (targetType == TargetType.HighestVit)
        {
            return(GetHighestVit(type));
        }
        else if (targetType == TargetType.LowestVit)
        {
            return(GetLowestVit(type));
        }

        return(null);
    }
コード例 #2
0
    //Gets the target specified by the card's target type
    private Vector2 GetCardTarget(Card.CastType type)
    {
        TargetType currentTargetType = targetType;

        if (attackSequence[attackCardIndex].targetBehaviour != TargetType.Default)
        {
            currentTargetType = attackSequence[attackCardIndex].targetBehaviour;
        }

        if (currentTargetType == TargetType.Self)
        {
            return(transform.position);
        }
        else if (currentTargetType == TargetType.Nearest)
        {
            return(GetNearest(type));
        }
        else if (currentTargetType == TargetType.Furthest)
        {
            return(GetFurthest(type));
        }
        else if (currentTargetType == TargetType.HighestShield)
        {
            return(GetHighestShield(type));
        }
        else if (currentTargetType == TargetType.LowestShield)
        {
            return(GetLowestShield(type));
        }
        else if (currentTargetType == TargetType.HighestVit)
        {
            return(GetHighestVit(type));
        }
        else if (currentTargetType == TargetType.LowestVit)
        {
            return(GetLowestVit(type));
        }
        else if (currentTargetType == TargetType.MostMissingHealth)
        {
            return(GetMostMissingHealth(type));
        }
        else if (currentTargetType == TargetType.HighestAttack)
        {
            return(GetHighestAttack(type));
        }
        else if (currentTargetType == TargetType.LowestAttack)
        {
            return(GetLowestAttack(type));
        }

        return(GetNearest(type));
    }
コード例 #3
0
    //Find the player with the lowest vitality
    private GameObject GetLowestVit(Card.CastType type)
    {
        GameObject output = null;

        string tag = "Player";

        if (type == Card.CastType.Enemy)
        {
            tag = "Enemy";
        }
        GameObject[] targets = GameObject.FindGameObjectsWithTag(tag);
        int          vit     = 999999999;

        foreach (GameObject target in targets)
        {
            if (target.GetComponent <HealthController>().GetVit() < vit)
            {
                vit    = target.GetComponent <HealthController>().GetShield();
                output = target;
            }
        }
        return(output);
    }
コード例 #4
0
    private GameObject GetFurthest(Card.CastType type)
    {
        GameObject output = null;

        string tag = "Player";

        if (type == Card.CastType.Enemy)
        {
            tag = "Enemy";
        }
        GameObject[] targets  = GameObject.FindGameObjectsWithTag(tag);
        int          distance = -99999999;

        foreach (GameObject target in targets)
        {
            if (GetDistanceFrom(target.transform.position) > distance)
            {
                distance = GetDistanceFrom(target.transform.position);
                output   = target;
            }
        }
        return(output);
    }
コード例 #5
0
    private Vector2 GetLowestAttack(Card.CastType type)
    {
        GameObject output = null;

        string tag = "Player";

        if (type == Card.CastType.Enemy)
        {
            tag = "Enemy";
        }
        GameObject[] targets = GameObject.FindGameObjectsWithTag(tag);
        output = targets[0];
        int lowestAttack = 999999999;

        foreach (GameObject target in targets)
        {
            if (target.GetComponent <HealthController>().GetAttack() - target.GetComponent <HealthController>().GetAttack() < lowestAttack)
            {
                lowestAttack = target.GetComponent <HealthController>().GetMaxVit() - target.GetComponent <HealthController>().GetCurrentVit();
                output       = target;
            }
        }
        return(output.transform.position);
    }
コード例 #6
0
    private Vector2 GetHighestVit(Card.CastType type)
    {
        GameObject output = null;

        string tag = "Player";

        if (type == Card.CastType.Enemy)
        {
            tag = "Enemy";
        }
        GameObject[] targets = GameObject.FindGameObjectsWithTag(tag);
        output = targets[0];
        int vit = 0;

        foreach (GameObject target in targets)
        {
            if (target.GetComponent <HealthController>().GetVit() > vit && target.GetComponent <HealthController>().GetVit() > 0)
            {
                vit    = target.GetComponent <HealthController>().GetVit();
                output = target;
            }
        }
        return(output.transform.position);
    }
コード例 #7
0
    private Vector2 GetFurthest(Card.CastType type)
    {
        GameObject output = null;

        string tag = "Player";

        if (type == Card.CastType.Enemy)
        {
            tag = "Enemy";
        }
        GameObject[] targets = GameObject.FindGameObjectsWithTag(tag);
        output = targets[0];
        int distance = -99999999;

        foreach (GameObject target in targets)
        {
            if (GetDistanceFrom(target.transform.position) > distance && target.GetComponent <HealthController>().GetVit() > 0)
            {
                distance = GetDistanceFrom(target.transform.position);
                output   = target;
            }
        }
        return(output.transform.position);
    }
コード例 #8
0
    private string[] GetTargetTags(Card.CastType type, Card.TargetType firstTargetType)
    {
        string[] tags;
        switch (type)
        {
        case Card.CastType.All:
            tags = new string[] { "Enemy", "Player" };
            break;

        case Card.CastType.Any:
            tags = new string[] { "Enemy", "Player" };
            break;

        case Card.CastType.Enemy:
            tags = new string[] { "Enemy" };
            break;

        case Card.CastType.AoE:
            if (firstTargetType == Card.TargetType.Enemy)
            {
                tags = new string[] { "Enemy" }
            }
            ;
            else
            {
                tags = new string[] { "Player" }
            };
            break;

        default:
            tags = new string[] { "Player" };
            break;
        }

        return(tags);
    }