示例#1
0
    TargetVisiblity GetTargetVisiblity(Unit Target)
    {
        TargetVisiblity result         = new TargetVisiblity();
        FieldData       data           = FieldDataAsset.I.GetFieldDataFromFieldType(Target.CurrentField.GetComponent <Field>().fieldType);
        FieldAttribute  fieldAttribute = data.GetFieldAttributeFromMobilityType(Target.UnitStats.mobilityType);

        result.curSoftpointVis = Target.curSoftpoints + (Target.curSoftpoints * fieldAttribute.visibility * Convert.ToInt32(Target.isMoving));
        result.curHardpointVis = Target.curHardpoints + (Target.curHardpoints * fieldAttribute.visibility * Convert.ToInt32(Target.isMoving));
        result.Target          = Target;

        return(result);
    }
示例#2
0
    TentativeDamage CalculateTentativeDamage(Unit Target, Unit Origin)
    {
        TentativeDamage result = new TentativeDamage();

        result.Origin = Origin;
        result.Target = Target;
        FieldData      targetData           = FieldDataAsset.I.GetFieldDataFromFieldType(Target.CurrentField.GetComponent <Field>().fieldType);
        FieldAttribute targetFieldAttribute = targetData.GetFieldAttributeFromMobilityType(Target.UnitStats.mobilityType);
        float          currentVisibleSP     = GetTargetVisiblity(Target).curSoftpointVis *(targetFieldAttribute.cover * Convert.ToInt32(!Target.isMoving));

        result.SP = Mathf.Ceil(Mathf.Min(currentVisibleSP, CalculateCurrentFirepower(Origin).curFirepowerSoft));
        if (float.IsNaN(result.SP))
        {
            result.SP = 0;
        }
        float currentVisibleHP = GetTargetVisiblity(Target).curHardpointVis *(targetFieldAttribute.cover * Convert.ToInt32(!Target.isMoving));

        result.HP = Mathf.Ceil(Mathf.Min(currentVisibleHP, CalculateCurrentFirepower(Origin).curFirepowerHard));
        if (float.IsNaN(result.HP))
        {
            result.HP = 0;
        }
        return(result);
    }