Пример #1
0
    public override bool KeepBehaviorCheck(AiShip leader, AiShip subject)
    {
        try
        {
            // Optimize -- Make sure the target is the same as the leaders.
            if (leader.GetTarget() == null)
                return false;

            if (leader.GetTarget().gameObject.name != subject.GetTarget().gameObject.name)
                return false;

            Attributes subjectStats = subject.getAttributes();
            // Get Percent / 100% using cross multiply
            double health = GetCurrentHealthPercentage();
            // comparison of factions may not work, check later.
            if (health >= 25 && leader.GetTarget() != null)
                return true;
        }
        catch
        {
            if (!subject)
                return false;

            if (subject.GetMyFleet().fleetLeader is PlayerShip)
                return false;

            if (!leader)
                leader = (AiShip)subject.GetMyFleet().fleetLeader;
        }

        return false;
    }
Пример #2
0
    public override bool KeepBehaviorCheck(AiShip leader, AiShip subject)
    {
        //Check if the behavior of the leader is the same as the subject.
        if (leader.GetBehavior().Equals(subject.GetBehavior()) && leader.ID != subject.ID)
            return true;

        AiShip enemyShip = leader.GetTarget().gameObject.GetComponent("AiShip") as AiShip;
        // For Leaders eyes Only
        if (leader.GetMyFleet().threat < (enemyShip.GetMyFleet().threat * 10))
            return true;

        return false;
    }