protected override List <Vector2> GenerateUVs(PartDirection direction, PartRotation rotation)
    {
        List <Vector2> uvs         = new List <Vector2>();
        float          textureUnit = 0.0625f;

        for (int i = 0; i < GenerateVertices(direction, rotation, 0, 0, 0).Count / 4; i++)
        {
            if (i < ((536 / 4) - (360 / 4)))
            {
                uvs.Add(new Vector2(textureUnit * (uv_Barrols.x), textureUnit * (uv_Barrols.y)));
                uvs.Add(new Vector2(textureUnit * (uv_Barrols.x), textureUnit * (uv_Barrols.y + 1)));
                uvs.Add(new Vector2(textureUnit * (uv_Barrols.x + 1), textureUnit * (uv_Barrols.y)));
                uvs.Add(new Vector2(textureUnit * (uv_Barrols.x + 1), textureUnit * (uv_Barrols.y + 1)));
            }
            else
            {
                uvs.Add(new Vector2(textureUnit * (uv_Binders.x), textureUnit * (uv_Binders.y)));
                uvs.Add(new Vector2(textureUnit * (uv_Binders.x), textureUnit * (uv_Binders.y + 1)));
                uvs.Add(new Vector2(textureUnit * (uv_Binders.x + 1), textureUnit * (uv_Binders.y)));
                uvs.Add(new Vector2(textureUnit * (uv_Binders.x + 1), textureUnit * (uv_Binders.y + 1)));
            }
        }

        //uvs.Add(new Vector2(textureUnit * 1, textureUnit * 1));
        //uvs.Add(new Vector2(textureUnit * 1, textureUnit * 2));
        //uvs.Add(new Vector2(textureUnit * 2, textureUnit * 1));
        //uvs.Add(new Vector2(textureUnit * 2, textureUnit * 2));
        //uvs.Add(new Vector2(textureUnit * 1, textureUnit * 1));
        //uvs.Add(new Vector2(textureUnit * 1, textureUnit * 2));
        //uvs.Add(new Vector2(textureUnit * 2, textureUnit * 1));
        //uvs.Add(new Vector2(textureUnit * 2, textureUnit * 2));

        return(uvs);
    }
    protected override List <Vector2> GenerateUVs(PartDirection direction, PartRotation rotation)
    {
        List <Vector2> uvs         = new List <Vector2>();
        float          textureUnit = 0.0625f;

        for (int i = 0; i < GenerateVertices(direction, rotation, 0, 0, 0).Count / 4; i++)
        {
            if (i >= 24 && i < 52)
            {
                uvs.Add(new Vector2(textureUnit * (orange.x), textureUnit * (orange.y)));
                uvs.Add(new Vector2(textureUnit * (orange.x), textureUnit * (orange.y + 1)));
                uvs.Add(new Vector2(textureUnit * (orange.x + 1), textureUnit * (orange.y)));
                uvs.Add(new Vector2(textureUnit * (orange.x + 1), textureUnit * (orange.y + 1)));
            }
            else
            {
                uvs.Add(new Vector2(textureUnit * (darkGrey.x), textureUnit * (darkGrey.y)));
                uvs.Add(new Vector2(textureUnit * (darkGrey.x), textureUnit * (darkGrey.y + 1)));
                uvs.Add(new Vector2(textureUnit * (darkGrey.x + 1), textureUnit * (darkGrey.y)));
                uvs.Add(new Vector2(textureUnit * (darkGrey.x + 1), textureUnit * (darkGrey.y + 1)));
            }
        }

        return(uvs);
    }
 public PartConfiguration()
 {
     partDirection = PartDirection.North;
     partRotation  = PartRotation.Up;
     partPosition  = new Vector3Int(0, 0, 0);
     partType      = PartType.NONE;
 }
Exemple #4
0
    public bool CanBeConnected(ConnectorType otherType, PartDirection otherDirection, int boxColliderIndex)
    {
        if (isConnected == false && boxColliderDirections != null && boxColliders != null && boxColliderDirections.Length == boxColliders.Length && boxColliderIndex >= 0 && boxColliderIndex < boxColliderDirections.Length && acceptedConnectortypes != null && acceptedConnectortypes.Length > 0)
        {
            bool isItAcceptable = false;
            for (int i = 0; i < acceptedConnectortypes.Length; i++)
            {
                if (acceptedConnectortypes[i] == otherType)
                {
                    isItAcceptable = true;
                    break;
                }
            }

            if (isItAcceptable)
            {
                PartDirection acceptedDirection = boxColliderDirections[boxColliderIndex];

                return(acceptedDirection == otherDirection);
            }
            else
            {
                return(false);
            }
        }
        else
        {
            return(false);
        }
    }
Exemple #5
0
    public static Vector3Int ToVector3Int(this PartDirection pD)
    {
        switch (pD)
        {
        case PartDirection.Down:
            return(new Vector3Int(0, -1, 0));

        case PartDirection.Up:
            return(new Vector3Int(0, 1, 0));

        case PartDirection.East:
            return(new Vector3Int(1, 0, 0));

        case PartDirection.West:
            return(new Vector3Int(-1, 0, 0));

        case PartDirection.North:
            return(new Vector3Int(0, 0, 1));

        case PartDirection.South:
            return(new Vector3Int(0, 0, -1));

        default:
            return(new Vector3Int(0, 0, 1));
        }
    }
 public PartConfiguration(PartDirection direction, PartRotation rotation, Vector3Int position, PartType type)
 {
     partDirection = direction;
     partRotation  = rotation;
     partPosition  = position;
     partType      = type;
 }
    /// <summary>
    /// Trys to place a part with the given parameters
    /// </summary>
    /// <param name="type">The type of the part to place</param>
    /// <param name="direction">The direction of the part to place</param>
    /// <param name="rotation">The rotation of the part to place</param>
    /// <param name="position">The position, where the part should be placed</param>
    /// <returns>Whether the part has been successfully placed</returns>
    public bool AddPart(PartType type, PartDirection direction, PartRotation rotation, Vector3Int position)
    {
        bool canBePlaced = CanBePlaced(type, direction, rotation, position);

        if (!canBePlaced)
        {
            return(false);
        }
        else
        {
            GameObject newPartGameobject = (GameObject)Instantiate(partBuilding);

            parts.Add(newPartGameobject.GetComponent <PartBuilding>());

            parts[parts.Count - 1].SetPosition(position);
            parts[parts.Count - 1].SetDirection(direction);
            parts[parts.Count - 1].SetRotation(rotation);
            parts[parts.Count - 1].SetPart(type);

            connectOverlapingConnectors(parts[parts.Count - 1]);

            Debug.Log("Added part: " + type.ToString() + " at: " + position.ToString());

            return(true);
        }
    }
    public ConnectorGearCorner(PartDirection facedDirection, Vector3 relativePosition)
    {
        type = ConnectorType.GEAR_CORNER;

        this.facedDirection = facedDirection;
        connectorPosition   = new Vector3Int(relativePosition.x, relativePosition.y, relativePosition.z);

        //Vector3 addVector = Vector3.zero;
        //if (facedDirection == PartDirection.East)
        //    addVector = new Vector3(1f, 0, 0);
        //if (facedDirection == PartDirection.West)
        //    addVector = new Vector3(-1f, 0, 0);
        //
        //this.connectingPosition = relativePosition + addVector;
        boxColliderDirections     = new PartDirection[6];
        boxColliderDirections[0]  = PartDirection.Down;
        boxColliderDirections[1]  = PartDirection.East;
        boxColliderDirections[2]  = PartDirection.North;
        boxColliderDirections[3]  = PartDirection.South;
        boxColliderDirections[4]  = PartDirection.Up;
        boxColliderDirections[5]  = PartDirection.West;
        acceptedConnectortypes    = new ConnectorType[1];
        acceptedConnectortypes[0] = ConnectorType.GEAR_CORNER;

        boxColliders = new BoxCollider[6];
    }
Exemple #9
0
    public int AddWheel(PartType type, Vector3 position, PartDirection direction, PartRotation rotation, bool powered, bool steered, float radius, float grip, float maxSteerAngle, float health)
    {
        CalculatedWheel newWheel = new CalculatedWheel();

        newWheel.Position              = position + seatOffset;
        newWheel.Direction             = direction;
        newWheel.Rotation              = rotation;
        newWheel.Powering              = powered;
        newWheel.Steering              = steered;
        newWheel.Type                  = type;
        newWheel.Radius                = radius;
        newWheel.Grip                  = grip;
        newWheel.SteerAngle            = maxSteerAngle >= 0 ? maxSteerAngle : -1 * maxSteerAngle;
        newWheel.SteerCorrectDirection = maxSteerAngle >= 0;

        newWheel.DamperStrength = 4500 * (Weight * 0.001f) * 0.6f;
        newWheel.SpringStrength = 35000 * (Weight * 0.001f) * 0.6f;
        if (health != -1)
        {
            newWheel.Health = health;
        }

        newWheel.ID = idCounter;
        idCounter++;

        wheels.Add(newWheel);

        return(newWheel.ID);
    }
Exemple #10
0
    protected override List <Vector2> GenerateUVs(PartDirection direction, PartRotation rotation)
    {
        List <Vector2> uvs         = new List <Vector2>();
        float          textureUnit = 0.0625f;

        for (int i = 0; i < GenerateVertices(direction, rotation, 0, 0, 0).Count / 4; i++)
        {
            if (i < 5 * amountOfEdgesAtBorder)
            {
                uvs.Add(new Vector2(textureUnit * (outer.x), textureUnit * (outer.y)));
                uvs.Add(new Vector2(textureUnit * (outer.x), textureUnit * (outer.y + 1)));
                uvs.Add(new Vector2(textureUnit * (outer.x + 1), textureUnit * (outer.y)));
                uvs.Add(new Vector2(textureUnit * (outer.x + 1), textureUnit * (outer.y + 1)));
            }
            else
            {
                uvs.Add(new Vector2(textureUnit * (innner.x), textureUnit * (innner.y)));
                uvs.Add(new Vector2(textureUnit * (innner.x), textureUnit * (innner.y + 1)));
                uvs.Add(new Vector2(textureUnit * (innner.x + 1), textureUnit * (innner.y)));
                uvs.Add(new Vector2(textureUnit * (innner.x + 1), textureUnit * (innner.y + 1)));
            }
        }

        return(uvs);
    }
Exemple #11
0
    public void SetProperties(PartType type, PartDirection direction, PartRotation rotation, Vector3Int position)
    {
        instPart = (GameObject)Instantiate(prefabPartVisible);
        instPart.transform.parent = transform;
        instPart.GetComponent <PartVisible>().SetRotation(rotation);
        instPart.GetComponent <PartVisible>().SetDirection(direction);
        instPart.GetComponent <PartVisible>().SetPosition(position);
        instPart.GetComponent <PartVisible>().SetPart(PartType.PartWeaponMinigun_0);

        instBarrels = (GameObject)Instantiate(prefabPartVisible);
        instBarrels.transform.parent = transform;
        instBarrels.GetComponent <PartVisible>().SetRotation(rotation);
        instBarrels.GetComponent <PartVisible>().SetDirection(direction);
        instBarrels.GetComponent <PartVisible>().SetPosition(position);
        instBarrels.GetComponent <PartVisible>().SetPart(PartType.PartWeaponMinigun_1);

        relativeBulletSpawnPos  = position.ToVector3() + new Vector3(0f, 0f, 6.5f);
        relativeCapsuleSpawnPos = position.ToVector3() + new Vector3(1.5f, 1.5f, 2f);

        rotateAroundAxe = direction.ToVector3();

        instEmpty = Instantiate(empty);
        instEmpty.transform.parent        = transform;
        instEmpty.transform.localPosition = relativeBulletSpawnPos;
    }
Exemple #12
0
    /// <summary>
    /// Returns the direction that points in the opposite direction
    /// </summary>
    /// <param name="pD">The direction the oposite is requested</param>
    /// <returns>The oposite direction</returns>
    public static PartDirection Opposite(this PartDirection pD)
    {
        switch (pD)
        {
        case PartDirection.Down:
            return(PartDirection.Up);

        case PartDirection.Up:
            return(PartDirection.Down);

        case PartDirection.East:
            return(PartDirection.West);

        case PartDirection.West:
            return(PartDirection.East);

        case PartDirection.North:
            return(PartDirection.South);

        case PartDirection.South:
            return(PartDirection.North);

        default:
            return(PartDirection.East);
        }
    }
Exemple #13
0
    public static Vector3 ToVector3(this PartDirection pD)
    {
        switch (pD)
        {
        case PartDirection.Down:
            return(new Vector3(0f, -1f, 0f));

        case PartDirection.Up:
            return(new Vector3(0f, 1f, 0f));

        case PartDirection.East:
            return(new Vector3(1f, 0f, 0f));

        case PartDirection.West:
            return(new Vector3(-1f, 0f, 0f));

        case PartDirection.North:
            return(new Vector3(0f, 0f, 1f));

        case PartDirection.South:
            return(new Vector3(0f, 0f, -1f));

        default:
            return(new Vector3(0f, 0f, 1f));
        }
    }
Exemple #14
0
 public void SetProperties(PartType type, PartDirection direction, PartRotation rotation, Vector3Int position)
 {
     instPart = (GameObject)Instantiate(prefabPartVisible);
     instPart.transform.parent = transform;
     instPart.GetComponent <PartVisible>().SetRotation(rotation);
     instPart.GetComponent <PartVisible>().SetDirection(direction);
     instPart.GetComponent <PartVisible>().SetPosition(position);
     instPart.GetComponent <PartVisible>().SetPart(type);
 }
Exemple #15
0
    public override Connectionpoint[] GetConnectionpoints(PartDirection direction, PartRotation rotation)
    {
        Connectionpoint[] connectionPoints = new Connectionpoint[2];

        Vector3 directionVector = direction.ToVector3();

        connectionPoints[0] = new ConnectorCrossHole(direction.Opposite(), directionVector);
        connectionPoints[1] = new ConnectorCrossHole(direction, new Vector3(0f, 0f, 0f));

        return(connectionPoints);
    }
 public void SetProperties(PartType type, PartDirection direction, PartRotation rotation, Vector3Int position, Vector3 axeRotateAround, float speedRelativeToWheel)
 {
     instPart = (GameObject)Instantiate(prefabPartVisible);
     instPart.transform.parent = transform;
     instPart.GetComponent <PartVisible>().SetRotation(rotation);
     instPart.GetComponent <PartVisible>().SetDirection(direction);
     instPart.GetComponent <PartVisible>().SetPosition(position);
     instPart.GetComponent <PartVisible>().SetPart(type);
     this.speedRelativeToWheel = speedRelativeToWheel;
     rotateAroundAxe           = axeRotateAround;
 }
Exemple #17
0
    public void SetProperties(PartType type, PartDirection direction, PartRotation rotation, Vector3Int position, Vector3 movingTowardsAxe, float halfwayDistance)
    {
        instPart = (GameObject)Instantiate(prefabPartVisible);
        instPart.transform.parent = transform;
        instPart.GetComponent <PartVisible>().SetRotation(rotation);
        instPart.GetComponent <PartVisible>().SetDirection(direction);
        instPart.GetComponent <PartVisible>().SetPosition(position);
        instPart.GetComponent <PartVisible>().SetPart(type);
        this.halfwayDistance  = halfwayDistance;
        this.movingTowardsAxe = movingTowardsAxe;

        originLocalPos = instPart.transform.localPosition;
    }
Exemple #18
0
    public override Connectionpoint[] GetConnectionpoints(PartDirection direction, PartRotation rotation)
    {
        Connectionpoint[] connectionPoints = new Connectionpoint[5];

        Vector3 directionVector = direction.ToVector3();

        connectionPoints[0] = new ConnectorCrossPin(direction, directionVector * 4);
        connectionPoints[1] = new ConnectorCrossPin(direction, directionVector * 3);
        connectionPoints[2] = new ConnectorCrossPin(direction, directionVector * 2);
        connectionPoints[3] = new ConnectorCrossPin(direction, directionVector);
        connectionPoints[4] = new ConnectorCrossPin(direction.Opposite(), new Vector3(0f, 0f, 0f));

        return(connectionPoints);
    }
Exemple #19
0
    protected override List <Vector2> GenerateUVs(PartDirection direction, PartRotation rotation)
    {
        List <Vector2> uvs         = new List <Vector2>();
        float          textureUnit = 0.0625f;

        for (int i = 0; i < GenerateVertices(direction, rotation, 0, 0, 0).Count / 4; i++)
        {
            uvs.Add(new Vector2(textureUnit * 4, textureUnit * 4));
            uvs.Add(new Vector2(textureUnit * 4, textureUnit * 5));
            uvs.Add(new Vector2(textureUnit * 5, textureUnit * 4));
            uvs.Add(new Vector2(textureUnit * 5, textureUnit * 5));
        }

        return(uvs);
    }
Exemple #20
0
    public int AddProperties(PartType type, PartDirection direction, PartRotation rotation, Vector3Int position)
    {
        if (instPart == null)
        {
            instPart = (GameObject)Instantiate(prefabPartVisibleMulti);
            instPart.transform.parent   = transform;
            instPart.transform.position = Vector3.zero;
            instPart.tag = gameObject.tag;
        }
        instPart.GetComponent <PartVisibleMulti>().AddPart(type, position, direction, rotation);

        configs.Add(new PartConfiguration(direction, rotation, position, type));

        return(instPart.GetComponent <PartVisibleMulti>().VerticesCount);
    }
Exemple #21
0
    protected override List <int> GenerateTriangles(PartDirection direction, PartRotation rotation, int faceCount)
    {
        List <int> trias = new List <int>();

        for (int i = 0; i < GenerateVertices(direction, rotation, 0, 0, 0).Count / 4; i++)
        {
            trias.Add(faceCount + i * 4);
            trias.Add(faceCount + i * 4 + 2);
            trias.Add(faceCount + i * 4 + 1);
            trias.Add(faceCount + i * 4 + 2);
            trias.Add(faceCount + i * 4 + 3);
            trias.Add(faceCount + i * 4 + 1);
        }

        return(trias);
    }
Exemple #22
0
    /// <summary>
    /// This method checks, if a part can be connected to a given collider
    /// </summary>
    /// <param name="hitCollider">The collider, where the part should be tryed to connect</param>
    /// <param name="type">The type of the part, that trys to connect</param>
    /// <param name="direction">The direction of the part, that trys to connect</param>
    /// <param name="connectorPosition">Here you get the relative position of the connection point</param>
    /// <returns>Whether it can be connected or not</returns>
    public bool MatchConnection(Collider hitCollider, ConnectorType type, PartDirection direction, out Vector3Int connectorPosition)
    {
        int connectorIndex = -1;

        for (int i = 0; i < connectionPoints.Length; i++)
        {
            if (connectionPoints[i].IsYourBoxCollider(hitCollider))
            {
                connectorIndex = i;
                break;
            }
        }
        if (connectorIndex == -1)
        {
            connectorPosition = new Vector3Int();
            return(false);
        }
        else
        {
            bool canBe = connectionPoints[connectorIndex].CanBeConnected(type, direction, connectionPoints[connectorIndex].GetBoxColliderIndex(hitCollider));
            connectorPosition = connectionPoints[connectorIndex].ConnectorPosition;
            return(canBe);
        }


        //int boxColliderIndex = -1;
        //for (int i = 0; i < createdBoxColliders.Length; i++)
        //{
        //    if (hitCollider == createdBoxColliders[i])
        //    {
        //        boxColliderIndex = i;
        //        break;
        //    }
        //}
        //
        //if (boxColliderIndex == -1)
        //{
        //    connectorPosition = Vector3.zero;
        //    return false;
        //}
        //else
        //{
        //    bool canBe = connectionPoints[boxColliderIndex].CanBeConnected(type, direction);
        //    connectorPosition = connectionPoints[boxColliderIndex].ConnectingPosition;
        //    return canBe;
        //}
    }
    public bool HitCollider(Collider hitCollider, ConnectorType type, PartDirection direction, out Vector3Int connectorPosition)
    {
        bool hitting = false;

        connectorPosition = new Vector3Int(0, 0, 0);
        for (int i = 0; i < parts.Count; i++)
        {
            Vector3Int posit;
            hitting = parts[i].MatchConnection(hitCollider, type, direction, out posit);
            if (hitting)
            {
                connectorPosition = posit.Add(parts[i].Position);
                break;
            }
        }

        return(hitting);
    }
Exemple #24
0
    public int AddSeat(Vector3 position, PartDirection direction, PartRotation rotation, float health)
    {
        seatOffset = -1 * position;

        seat           = new CalculatedPart();
        seat.Position  = position + seatOffset;
        seat.Rotation  = rotation;
        seat.Direction = direction;
        seat.Type      = PartType.PartSeat;
        if (health != -1)
        {
            seat.Health = health;
        }

        seat.ID = idCounter;
        idCounter++;

        return(seat.ID);
    }
Exemple #25
0
    public int AddPart(PartType type, Vector3 position, PartDirection direction, PartRotation rotation, float health)
    {
        CalculatedPart newPart = new CalculatedPart();

        newPart.Position  = position + seatOffset;
        newPart.Direction = direction;
        newPart.Rotation  = rotation;
        newPart.Type      = type;
        if (health != -1)
        {
            newPart.Health = health;
        }

        newPart.ID = idCounter;
        idCounter++;

        staticParts.Add(newPart);

        return(newPart.ID);
    }
Exemple #26
0
    public ConnectorSolid(PartDirection facedDirection, Vector3 relativePosition)
    {
        type = ConnectorType.SOLID;

        this.facedDirection = facedDirection;
        connectorPosition   = new Vector3Int(relativePosition.x, relativePosition.y, relativePosition.z);

        //Vector3 addVector = Vector3.zero;
        //if (facedDirection == PartDirection.East)
        //    addVector = new Vector3(1f, 0, 0);
        //if (facedDirection == PartDirection.West)
        //    addVector = new Vector3(-1f, 0, 0);
        //
        //this.connectingPosition = relativePosition + addVector;
        boxColliderDirections    = new PartDirection[1];
        boxColliderDirections[0] = facedDirection;
        acceptedConnectortypes   = new ConnectorType[0];

        boxColliders = new BoxCollider[2];
    }
Exemple #27
0
    public int AddMinigun(PartType type, Vector3 position, PartDirection direction, PartRotation rotation, float health)
    {
        CalculatedMinigun newMinigun = new CalculatedMinigun();

        newMinigun.Position  = position + seatOffset;
        newMinigun.Direction = direction;
        newMinigun.Rotation  = rotation;
        newMinigun.Type      = type;

        if (health != -1)
        {
            newMinigun.Health = health;
        }

        newMinigun.ID = idCounter;
        idCounter++;

        miniguns.Add(newMinigun);

        return(newMinigun.ID);
    }
    public ConnectorCrossPower(PartDirection facedDirection, Vector3 relativePosition)
    {
        type = ConnectorType.CROSS_POWER;

        this.facedDirection = facedDirection;
        connectorPosition   = new Vector3Int(relativePosition.x, relativePosition.y, relativePosition.z);

        //Vector3 addVector = Vector3.zero;
        //if (facedDirection == PartDirection.East)
        //    addVector = new Vector3(1f, 0, 0);
        //if (facedDirection == PartDirection.West)
        //    addVector = new Vector3(-1f, 0, 0);
        //
        //this.connectingPosition = relativePosition + addVector;
        boxColliderDirections     = new PartDirection[2];
        boxColliderDirections[0]  = facedDirection.Opposite();
        boxColliderDirections[1]  = facedDirection;
        acceptedConnectortypes    = new ConnectorType[1];
        acceptedConnectortypes[0] = ConnectorType.CROSS_PIN;

        boxColliders = new BoxCollider[2];
    }
Exemple #29
0
    public int AddPowertrainAxe(PartType type, Vector3 position, PartDirection direction, PartRotation rotation, int accordingWheelID, float factorToWheel, Vector3 rotateAroundAxe, float health)
    {
        CalculatedPowertrainAxe newPtAxe = new CalculatedPowertrainAxe();

        newPtAxe.Position         = position + seatOffset;
        newPtAxe.Direction        = direction;
        newPtAxe.Rotation         = rotation;
        newPtAxe.AccordingWheelID = accordingWheelID;
        newPtAxe.FactorToWheel    = factorToWheel;
        newPtAxe.RotateAroundAxe  = rotateAroundAxe;
        newPtAxe.Type             = type;
        if (health != -1)
        {
            newPtAxe.Health = health;
        }

        newPtAxe.ID = idCounter;
        idCounter++;

        powertrainAxes.Add(newPtAxe);

        return(newPtAxe.ID);
    }
Exemple #30
0
    public int AddSteerBar(PartType type, Vector3 position, PartDirection direction, PartRotation rotation, Vector3 moveAlongAxe, float halfwayDistance, float health)
    {
        CalculatedSteerBar newSteerBar = new CalculatedSteerBar();

        newSteerBar.Position  = position + seatOffset;
        newSteerBar.Direction = direction;
        newSteerBar.Rotation  = rotation;
        newSteerBar.Type      = type;

        newSteerBar.AxeMoveAlong    = moveAlongAxe;
        newSteerBar.HalfwayDistance = halfwayDistance;
        if (health != -1)
        {
            newSteerBar.Health = health;
        }

        newSteerBar.ID = idCounter;
        idCounter++;

        steerBars.Add(newSteerBar);

        return(newSteerBar.ID);
    }