예제 #1
0
        //methods
        public void Use(ITargetable Target)
        {
            if (!CanCast())
            {
                return;
            }

            if (Target.GetType() != typeof(Objects.Monsters.Exemples.EvilSinger) || Target.GetType() != typeof(Objects.Monsters.Exemples.Necromant) || Target.GetType() != typeof(Objects.Monsters.Exemples.Zombie))
            {
                return;
            }

            //costing
            HeroRef.Csp -= Cost;

            //dmg
            Int32 Dmg = this.Dmg(Target);

            Target.Chp -= Dmg;

            //msg
            DrawerLine Line = new DrawerLine();

            Line.DefaultForegroundColor = HeroRef.Color;
            Line.DefaultBackgroundColor = HeroRef.Back;
            Line += DCLine.New(Name, Color, Back);
            Line += " deal ";
            Line += DCLine.New(Dmg.ToString(), Color, Back);
            Line += " damage!";
            Temp.State.Current.Chat.Message(Line);
        }
예제 #2
0
        public static String TargetSerialize(ITargetable tInput)
        {
            string strReturn = "";

            strReturn += tInput.GetType();
            strReturn += ",";

            if (tInput is Vessel)
            {
                Vessel tmpVessel = tInput as Vessel;
                strReturn += tmpVessel.id.ToString();
            }
            else if (tInput is CelestialBody)
            {
                CelestialBody tmpBody = tInput as CelestialBody;
                strReturn += tmpBody.bodyName;
            }

            return(strReturn);
        }
예제 #3
0
        private void DrawTargetContent()
        {
            string      targetTypeString = Localizer.Format("#RT_RoverFragment_coordinations");                                      //"Body coordinations"
            string      tooltip          = Localizer.Format("#RT_RoverFragment_coordinations_desc", GameSettings.MODIFIER_KEY.name); //"Hold " +  + " and click on ground to input coordinates"
            ITargetable Target           = mFlightComputer.Vessel.targetObject;

            if (GameSettings.MODIFIER_KEY.GetKey() && ((Input.GetMouseButton(0) || Input.GetMouseButton(1)) != MouseClick)) // on lookout for mouse click on body
            {
                MouseClick = Input.GetMouseButton(0) || Input.GetMouseButton(1);
                Vector2 latlon;
                if (MouseClick && RTUtil.CBhit(mFlightComputer.Vessel.mainBody, out latlon))
                {
                    Latitude  = latlon.x;
                    Longitude = latlon.y;
                }
            }
            else if (Target != null) // only if target is vessel not world coord
            {
                if (Target.GetType().ToString().Equals("Vessel"))
                {
                    Vessel TargetVessel = Target as Vessel;
                    Latitude         = (float)TargetVessel.latitude;
                    Longitude        = (float)TargetVessel.longitude;
                    targetTypeString = Localizer.Format("#RT_RoverFragment_TargetVessel");      //"Designated Vessel"
                    tooltip          = Localizer.Format("#RT_RoverFragment_TargetVessel_desc"); //"Drive to this vessel"
                }
            }

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label(new GUIContent(Localizer.Format("#RT_RoverFragment_HDGSteer"), Localizer.Format("#RT_RoverFragment_HDGSteer_desc"))); //"Steer: ", "How sharp to turn at max"
                GUILayout.FlexibleSpace();
                GUILayout.Label(new GUIContent(mSteerClamp.ToString("P"), Localizer.Format("#RT_RoverFragment_HDGSteer_desc")));                      //"How sharp to turn at max"
                GUILayout.Label(new GUIContent("max", Localizer.Format("#RT_RoverFragment_HDGSteer_desc")), GUILayout.Width(40));                     // "How sharp to turn at max"
            }
            GUILayout.EndHorizontal();

            RTUtil.HorizontalSlider(ref mSteerClamp, 0, 1);

            GUILayout.Label(new GUIContent(Localizer.Format("#RT_RoverFragment_ModeLabel", targetTypeString), tooltip));//"Mode: "

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label(new GUIContent(Localizer.Format("#RT_RoverFragment_LAT"), Localizer.Format("#RT_RoverFragment_LAT_desc")), GUILayout.Width(50));//"LAT", "Latitude to drive to"
                GUI.SetNextControlName("RC1");
                RTUtil.TextField(ref mLatitude, GUILayout.Width(50), GUILayout.ExpandWidth(false));
                GUILayout.Label(new GUIContent("(°)", Localizer.Format("#RT_RoverFragment_coordinations_desc", GameSettings.MODIFIER_KEY.name)), GUI.skin.textField, GUILayout.Width(40));//"Hold " +  + " and click on ground to input coordinates"
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label(new GUIContent(Localizer.Format("#RT_RoverFragment_LON"), Localizer.Format("#RT_RoverFragment_LON_desc")), GUILayout.Width(50));//"LON", "Longitude to drive to"
                GUI.SetNextControlName("RC2");
                RTUtil.TextField(ref mLongditude, GUILayout.Width(50), GUILayout.ExpandWidth(false));
                GUILayout.Label(new GUIContent("(°)", Localizer.Format("#RT_RoverFragment_coordinations_desc", GameSettings.MODIFIER_KEY.name)), GUI.skin.textField, GUILayout.Width(40));//"Hold " +  + " and click on ground to input coordinates"
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label(new GUIContent(Localizer.Format("#RT_RoverFragment_Speed"), Localizer.Format("#RT_RoverFragment_HDGSpeed_desc")), GUILayout.Width(50));//"Speed", "Speed to maintain"
                GUI.SetNextControlName("RC3");
                RTUtil.TextField(ref mSpeed, GUILayout.Width(50), GUILayout.ExpandWidth(false));
                GUILayout.Label(new GUIContent("(m/s)", Localizer.Format("#RT_RoverFragment_HDGSpeed_desc")), GUI.skin.textField, GUILayout.Width(40));//"Speed to maintain"
            }
            GUILayout.EndHorizontal();


            mLatitude   = RTUtil.ConstrictNum(mLatitude);
            mLongditude = RTUtil.ConstrictNum(mLongditude);
            mSpeed      = RTUtil.ConstrictNum(mSpeed, false);
        }
예제 #4
0
        private void UpdateTarget()
        {
            activeTarget = FlightGlobals.fetch.VesselTarget;
            if (activeTarget != null)
            {
                targetDisplacement = activeTarget.GetTransform().position - vessel.GetTransform().position;
                targetDirection    = targetDisplacement.normalized;

                targetRelativeVelocity = vessel.obt_velocity - activeTarget.GetObtVelocity();
                targetCmpSpeed         = -1.0;
                targetDockingTransform = null;

                if (activeTarget is Vessel)
                {
                    targetType = ((activeTarget as Vessel).vesselType == VesselType.SpaceObject) ? TargetType.Asteroid : TargetType.Vessel;
                }
                else if (activeTarget is CelestialBody)
                {
                    targetType = TargetType.CelestialBody;
                }
                else if (activeTarget is ModuleDockingNode)
                {
                    targetType             = TargetType.DockingPort;
                    targetDockingTransform = (activeTarget as ModuleDockingNode).GetTransform();
                }
                else if (activeTarget is PositionTarget)
                {
                    targetType = TargetType.PositionTarget;
                }
                else
                {
                    Utility.LogError(this, "UpdateTarget() - unable to classify target {0}", activeTarget.GetType().Name);
                    targetType = TargetType.None;
                }

                if (targetType == TargetType.Vessel || targetType == TargetType.DockingPort)
                {
                    UpdateTargetDockingPorts();
                }

                targetName  = activeTarget.GetName();
                targetOrbit = activeTarget.GetOrbit();
            }
            else
            {
                targetCmpSpeed         = 0.0;
                targetType             = TargetType.None;
                targetDisplacement     = Vector3.zero;
                targetRelativeVelocity = Vector3d.zero;
                targetDirection        = forward;
                targetDockingTransform = null;
                targetName             = string.Empty;
                targetOrbit            = null;
                if (targetDockingPorts.Length > 0)
                {
                    targetDockingPorts = new ModuleDockingNode[0];
                }
            }
            approachSolver.ResetComputation();
        }