//Methods
        public KLFVessel(String vessel_name, String owner_name, Guid _id)
        {
            info = new KLFVesselInfo();

            vesselName = vessel_name;
            ownerName = owner_name;
            id = _id;

            //Build the name of the game object
            System.Text.StringBuilder sb = new StringBuilder();
            sb.Append(vesselName);
            sb.Append(" (");
            sb.Append(ownerName);
            sb.Append(')');

            gameObj = new GameObject(sb.ToString());
            gameObj.layer = 9;

            generateActiveColor();

            line = gameObj.AddComponent<LineRenderer>();
            orbitRenderer = gameObj.AddComponent<OrbitRenderer>();

            line.transform.parent = gameObj.transform;
            line.transform.localPosition = Vector3.zero;
            line.transform.localEulerAngles = Vector3.zero;

            line.useWorldSpace = true;
            line.material = new Material(Shader.Find("Particles/Alpha Blended Premultiply"));
            line.SetVertexCount(2);
            line.enabled = false;

            orbitRenderer.forceDraw = true;

            mainBody = null;

            localDirection = Vector3.zero;
            localVelocity = Vector3.zero;
            localPosition = Vector3.zero;

            worldDirection = Vector3.zero;
            worldVelocity = Vector3.zero;
        }
Exemple #2
0
        //Methods
        public KLFVessel(String vesselName, String uName, Guid gid)
        {
            Info = new KLFVesselInfo();
            VesselName = vesselName;
            UserName = uName;
            Id = gid;

            //Build the name of the game object
            System.Text.StringBuilder sb = new StringBuilder();
            sb.Append(VesselName);
            sb.Append(" (");
            sb.Append(UserName);
            sb.Append(')');

            GameObj = new GameObject(sb.ToString());
            GameObj.layer = 9;

            GenerateActiveColor();

            Arc = GameObj.AddComponent<LineRenderer>();
            OrbitRender = GameObj.AddComponent<OrbitRenderer>();
            OrbitRender.driver = new OrbitDriver();

            Arc.transform.parent = GameObj.transform;
            Arc.transform.localPosition = Vector3.zero;
            Arc.transform.localEulerAngles = Vector3.zero;

            Arc.useWorldSpace = true;
            Arc.material = new Material(Shader.Find("Particles/Alpha Blended Premultiply"));
            Arc.SetVertexCount(2);
            Arc.enabled = false;

            MainBody = null;

            LocalDirection = Vector3.zero;
            LocalVelocity = Vector3.zero;
            LocalPosition = Vector3.zero;

            WorldDirection = Vector3.zero;
            WorldVelocity = Vector3.zero;
        }