public void ProbeForSpeciman(RadarType RT, Point2D PT)
        {
            bool HasSpeciman = false;

            foreach (Speciman S in _Specimans)
            {
                if (S.Location.Equals(PT))
                {
                    S.Found(RT);
                    HasSpeciman = true;
                    break;
                }
            }
            if (!HasSpeciman)
            {
                bool found = false;
                foreach (Point2D PTT in SearchedArea)
                {
                    if (PTT.Equals(PT))
                    {
                        found = true;
                        break;
                    }
                }
                if (!found)
                {
                    SearchedArea.Add(PT);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 获取目标索引
        /// </summary>
        /// <param name="speedItemList">在场单位列表(OrderBySpeed)</param>
        /// <param name="radarType">搜索方式</param>
        /// <param name="selfCamp">本方阵营</param>
        /// <param name="selfPos">当前单位的位置</param>
        /// <returns></returns>
        public static int GetTargetIndex(List <DataManager.SpeedItem> speedItemList, RadarType radarType, Camps selfCamp, int selfPos)
        {
            int posAdjust_Y = -1 * DataBase.cardPos[selfPos].y;

            DataBase.Pos targetPos = new DataBase.Pos();


            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 7; j++)
                {
                    //设置目标的坐标-前排优先
                    int posX = DataBase.cardPos[selfPos].x + front_first[i, j, 0];
                    int posY = DataBase.cardPos[selfPos].y + front_first[i, j, 1] + posAdjust_Y;
                    targetPos.set(posX, posY);
                    Console.WriteLine("posX: " + posX + "  posY: " + posY);

                    //获取目标索引
                    for (int s = 0; s < speedItemList.Count; s++)
                    {
                        if (speedItemList[s].card.BornPos == DataBase.GetPosIndex(targetPos))
                        {
                            if (speedItemList[s].camp != selfCamp)
                            {
                                return(s);
                            }
                        }
                    }
                }
            }
            return(-1);
        }
Beispiel #3
0
    void DrawLabel(int radarIndex, int nodeIndex, Rect labelRect, RadarType type)
    {
        switch (type)
        {
        case RadarType.CharacterStats:
            CharacterStatsNode nodeC = (CharacterStatsNode)iRadarGraphs[radarIndex].BaseNodes[nodeIndex];
            nodeC.statType = (CharacterStatType)EditorGUI.EnumPopup(labelRect, nodeC.statType);
            break;

        case RadarType.String_SAMPLE:
            StringNode_SAMPLE nodeR = (StringNode_SAMPLE)iRadarGraphs[radarIndex].BaseNodes[nodeIndex];
            nodeR.Name = EditorGUI.TextField(labelRect, nodeR.Name, CenteredStyle);
            break;

        case RadarType.CharacterStats_SAMPLE:
            CharacterStatsNode_SAMPLE nodeS = (CharacterStatsNode_SAMPLE)iRadarGraphs[radarIndex].BaseNodes[nodeIndex];
            nodeS.statType = (CharacterStatType_SAMPLE)EditorGUI.EnumPopup(labelRect, nodeS.statType);
            break;

        case RadarType.WeaponStats_SAMPLE:
            WeaponStatNode_SAMPLE nodeW = (WeaponStatNode_SAMPLE)iRadarGraphs[radarIndex].BaseNodes[nodeIndex];
            nodeW.statType = (WeaponStat_SAMPLE)EditorGUI.EnumPopup(labelRect, nodeW.statType);
            break;
        }
    }
Beispiel #4
0
 public void Init(MyMwcObjectBuilder_ShipConfig objectBuilder)
 {
     Engine.SetValue(objectBuilder.Engine);
     RadarType.SetValue((MyHudRadarTypesEnum)objectBuilder.RadarType);
     AutoLeveling.SetValue(objectBuilder.AutoLeveling);
     MovementSlowdown.SetValue(objectBuilder.MovementSlowdown);
     BackCamera.SetValue(objectBuilder.BackCamera);
     ViewMode.SetValue((MyViewModeTypesEnum)objectBuilder.ViewMode);
 }
Beispiel #5
0
    public RadarData(ItemQuality quality, float level, RadarType type, int range) : base(quality, level)
    {
        this.type  = type;
        this.range = range;

        name        = type.name();
        description = type.description();
        volume      = type.volume();
        itemType    = ItemType.RADAR;
    }
Beispiel #6
0
    void DrawRadarGraph(int radarIndex, int nodeCount, RadarType type)
    {
        Vector2 center  = position.size / 2;
        Vector3 center3 = center;

        Handles.color = Color.black;
        Handles.DrawSphere(42, center3 - Vector3.forward * 10, Quaternion.identity, 10f);

        for (int j = 0; j < nodeCount; j++)
        {
            float     nodeAngle      = j * unitAngle - 90f;
            Vector2   unitNodeVector = nodeAngle.ConvertAngleToVector2();
            RadarNode node           = iRadarGraphs[radarIndex].BaseNodes[j];

            node.center    = center;
            node.direction = unitNodeVector * shapeRadius;
            Vector2 boundaryNodePosition = center + unitNodeVector * shapeRadius;
            Rect    labelRect            = new Rect(-115f / 2f, -standardHeight / 2, 150, standardHeight).AddPosition(boundaryNodePosition).AddPosition(unitNodeVector * (labelSpacing));
            Rect    sliderRect           = new Rect(labelRect).AddPosition(Vector3.up * standardSpacing);
            node.maxPosition = boundaryNodePosition;

            if (j > 0)
            {
                RadarNode lastNode = iRadarGraphs[radarIndex].BaseNodes[j - 1];
                if (radarIndex == 0)
                {
                    DrawBoundaryLine(lastNode.maxPosition, node.maxPosition);
                    DrawSegmentLines(radarIndex, j - 1, j);
                }
                DrawActualValueLine(radarIndex, lastNode.Position, node.Position);
                Handles.DrawSphere(49, new Vector3(node.Position.x, node.Position.y, -10), Quaternion.identity, 5f);
            }
            float snapAmount = (1f / (segments + 1));

            if (radarIndex == SelectedRadarIndex || !hideUnSelectedHandles)
            {
                DrawHandle(radarIndex, j, nodeAngle, snapAmount);
            }
            if (drawWebLines)
            {
                DrawWebLine(radarIndex, j);
            }

            DrawSelectedGraphControls(radarIndex, j, sliderRect, labelRect, type);
        }
        if (radarIndex == 0)
        {
            DrawSegmentLines(radarIndex, nodeCount - 1, 0);
            DrawBoundaryLine(iRadarGraphs[radarIndex].BaseNodes[nodeCount - 1].maxPosition, iRadarGraphs[radarIndex].BaseNodes[0].maxPosition);
        }
        DrawActualValueLine(radarIndex, iRadarGraphs[radarIndex].BaseNodes[nodeCount - 1].Position, iRadarGraphs[radarIndex].BaseNodes[0].Position);
        Handles.DrawSphere(49, new Vector3(iRadarGraphs[radarIndex].BaseNodes[0].Position.x, iRadarGraphs[radarIndex].BaseNodes[0].Position.y, -10), Quaternion.identity, 5f);
    }
Beispiel #7
0
    public static RadarData createRadarData(RadarType type)
    {
        ItemQuality quality = randQuality();
        float       level   = randLevel();

        int range = Mathf.RoundToInt(type.range() * level * qualityMultiplier(quality));

        RadarData data = new RadarData(quality, level, type, range);

        data.initCommons(calculateCost(data), calculateEnergy(data));

        return(data);
    }
Beispiel #8
0
    void OnGUI()
    {
        if (ActiveObject != null)
        {
            TrySetRadarGraph();
            int radarCount = iRadarGraphs.Count;
            if (radarCount > 0)
            {
                RadarType type          = iRadarGraphs[0].RadarType;
                bool      tooFewNodes   = iRadarGraphs.Exists(graph => graph.BaseNodes.Count < minNodes);
                bool      graphMismatch = iRadarGraphs.Exists(graph => graph.RadarType != type);
                bool      showAll       = !tooFewNodes && !graphMismatch;
                if (!showAll)
                {
                    if (tooFewNodes)
                    {
                        EditorGUI.LabelField(firstRect, "Use at least 3 nodes");
                    }
                    else if (graphMismatch)
                    {
                        EditorGUI.LabelField(firstRect, "Selected graphs are mismatched types");
                    }
                }
                else
                {
                    int nodeCount = iRadarGraphs[0].BaseNodes.Count;
                    DrawHelperControls(radarCount, unitAngle);
                    for (int i = 0; i < radarCount; i++)
                    {
                        if (iRadarGraphs[i].ShouldReset())
                        {
                            iRadarGraphs[i].ResetNodes();
                        }

                        MySerializedObjects[i].Update();

                        DrawRadarGraph(i, nodeCount, type);
                        DrawAreaGraph(i);

                        if (GUI.changed)
                        {
                            Undo.RecordObject(ActiveObject, "Radar Graph Editor Modified");
                            EditorUtility.SetDirty(ActiveObject);
                        }
                        MySerializedObjects[i].ApplyModifiedProperties();
                    }
                }
            }
        }
        lastSelectedCount = ActiveObjects.Length;
    }
        public void Found(RadarType RT)
        {
            switch (RT)
            {
            case RadarType.Location:
                _locationFound = true;
                break;

            case RadarType.Size:
                _SizeFound = true;
                break;

            case RadarType.Name:
                _NameFound = true;
                break;
            }
        }
        /// <summary>
        /// Looks at the assigned radars and determines the type of radar
        /// system this is.
        /// The first block placed will classify the system.
        /// Once the system is classified, radar blocks not of the correct
        /// type cannot be added.
        /// </summary>
        private void ReclassifySystem()
        {
            if (_assignedRadars.Count == 0)
            {
                // The system has become unclassified
                _assignedType = RadarType.NONE;

                _settings.range     = Constants.radarMinimumRanges[(int)_assignedType];
                _settings.frequency = Constants.radarMinimumFreqs[(int)_assignedType];
            }
            else if (_assignedRadars.Count == 1 && _assignedType == RadarType.NONE)
            {
                _assignedType = _assignedRadars[0].type;

                _settings.range     = Constants.radarMinimumRanges[(int)_assignedType];
                _settings.frequency = Constants.radarMinimumFreqs[(int)_assignedType];
            }
        }
Beispiel #11
0
    public static int energyNeeded(this RadarType type)
    {
        switch (type)
        {
        case RadarType.SEQUESTER: return(10);

        case RadarType.PLANAR: return(20);

        case RadarType.MATRIX: return(30);

        case RadarType.PATAN_CORSAC: return(40);

        case RadarType.SNAKE: return(50);

        case RadarType.ASTRAL: return(60);

        default: return(0);
        }
    }
Beispiel #12
0
    public static Sprite getRadarSprite(RadarType type)
    {
        switch (type)
        {
        case RadarType.SEQUESTER: return(radars[0]);

        case RadarType.PLANAR: return(radars[1]);

        case RadarType.MATRIX: return(radars[2]);

        case RadarType.PATAN_CORSAC: return(radars[3]);

        case RadarType.SNAKE: return(radars[4]);

        case RadarType.ASTRAL: return(radars[5]);

        default: Debug.Log("Unknown radar type: " + type); return(null);
        }
    }
Beispiel #13
0
    public static float volume(this RadarType type)
    {
        switch (type)
        {
        case RadarType.SEQUESTER: return(.5f);

        case RadarType.PLANAR: return(.5f);

        case RadarType.MATRIX: return(.5f);

        case RadarType.PATAN_CORSAC: return(.5f);

        case RadarType.SNAKE: return(.5f);

        case RadarType.ASTRAL: return(.5f);

        default: return(0);
        }
    }
Beispiel #14
0
    public static int range(this RadarType type)
    {
        switch (type)
        {
        case RadarType.SEQUESTER: return(5);

        case RadarType.PLANAR: return(8);

        case RadarType.MATRIX: return(12);

        case RadarType.PATAN_CORSAC: return(20);

        case RadarType.SNAKE: return(30);

        case RadarType.ASTRAL: return(50);

        default: return(0);
        }
    }
Beispiel #15
0
    public static string name(this RadarType type)
    {
        switch (type)
        {
        case RadarType.SEQUESTER: return("Секвесторный радар");

        case RadarType.PLANAR: return("Планарный радар");

        case RadarType.MATRIX: return("Матричный радар");

        case RadarType.PATAN_CORSAC: return("Радар Патан-Корсака");

        case RadarType.SNAKE: return("Змеевой радар");

        case RadarType.ASTRAL: return("Астральный радар");

        default: return("Неизвестный тип радара");
        }
    }
Beispiel #16
0
    public static string description(this RadarType type)
    {
        switch (type)
        {
        case RadarType.SEQUESTER: return("Радар секвесторного\nтипа");

        case RadarType.PLANAR: return("Радар планарного\nтипа");

        case RadarType.MATRIX: return("Радар матричного\nтипа");

        case RadarType.PATAN_CORSAC: return("Радар типа\nПатан-Корсака");

        case RadarType.SNAKE: return("Радар змеевого\nтипа");

        case RadarType.ASTRAL: return("Радар астрального\nтипа");

        default: return("Неизвестный тип радара");
        }
    }
Beispiel #17
0
    public static RadarData createRadarData()
    {
        RadarType type = RadarType.SEQUESTER;

        switch (UnityEngine.Random.Range(0, Enum.GetNames(typeof(RadarType)).Length))
        {
        case 0: type = RadarType.SEQUESTER; break;

        case 1: type = RadarType.PLANAR; break;

        case 2: type = RadarType.MATRIX; break;

        case 3: type = RadarType.PATAN_CORSAC; break;

        case 4: type = RadarType.SNAKE; break;

        case 5: type = RadarType.ASTRAL; break;

        default: Debug.Log("Unmapped value for radar"); break;
        }
        return(createRadarData(type));
    }
Beispiel #18
0
    void DrawSelectedGraphControls(int radarIndex, int nodeIndex, Rect sliderRect, Rect labelRect, RadarType type)
    {
        RadarNode node = iRadarGraphs[radarIndex].BaseNodes[nodeIndex];

        if (radarIndex == SelectedRadarIndex)
        {
            DrawLabel(radarIndex, nodeIndex, labelRect, type);
            if (!setValuesManually)
            {
                if (node.isRangeReversed)
                {
                    node.Value = EditorGUI.Slider(sliderRect, node.Value, node.valueRange.Max, node.valueRange.Min);
                }
                else
                {
                    node.Value = EditorGUI.Slider(sliderRect, node.Value, node.valueRange.Min, node.valueRange.Max);
                }
            }
            else
            {
                node.Value = EditorGUI.FloatField(sliderRect, node.Value);
            }
        }
    }
 public Radar(GameControl GC, RadarType RT, string Name) : base(4, GC, Name)
 {
     _myType = RT;
 }
Beispiel #20
0
 public RadarData(RadarType type, object userData = null)
 {
     Type     = type;
     UserData = userData;
 }
Beispiel #21
0
 public RadarData(RadarType type, object userData = null)
 {
     Type = type;
     UserData = userData;
 }