예제 #1
0
 public void PlayMusic(string title)
 {
     if (Globals.loaded_data.music_dict.ContainsKey(title))
     {
         _audio.clip = Globals.loaded_data.music_dict[title][(int)Mathf.Floor(Random.Range(0, Globals.loaded_data.music_dict[title].Length - .001f))];
         _audio.Play();
     }
     else
     {
         Debug.LogFormat("Title does not exist: {0};\n {1}", title, DeveloppmentTools.LogIterable(Globals.loaded_data.music_dict.Keys));
     }
 }
예제 #2
0
    private void Awake()
    {
        NotLoadingRelated();
        if (!SceneGlobals.is_save)
        {
            PreLoading();
            loader.attack_data = new AttackData(Vector3.forward, new Vector3(0, 100, -200));
            loader.LoadEssentials();
            loader.LoadObjects();
            NextCommand();
        }
        PostLoading();

        Debug.Log(DeveloppmentTools.LogIterable(SceneObject.TotObjectList));
    }
예제 #3
0
 public override string ToString()
 {
     return(DeveloppmentTools.LogIterable(AllParts));
 }
예제 #4
0
    public void SelectorClicked(SelectorButton button)
    {
        SubSelector concerned = button.parent as SubSelector;

        if (concerned == null)
        {
            return;
        }
        byte option = button.num;

        bool multiple = concerned.targets.Length > 1;

        for (int i = 0; i < concerned.targets.Length; i++)
        {
            // Check Flags
            if (i != 0 && (button.flags >> 1) % 2 == 0)
            {
                // single vessel only
                goto LOOPEND;
            }
            if (i == 0 && button.flags % 2 == 1)
            {
                // use pinlabel
                Debug.Log(DeveloppmentTools.LogIterable(concerned.targets));
                concerned_objects = concerned.targets;
                lasting_command   = button.function;
            }

            IMarkerParentObject parentObject = concerned.targets[i];
            var ship = parentObject as Ship;

            SelectorOptions options = concerned.options;

            switch (button.function)
            {
//  +-----------------------------------------------------------------------------------------------------------------------+
//	|									Reference																			|
//  +-----------------------------------------------------------------------------------------------------------------------+
            case 0x0c:
// Set Camera ---------------------------------------------------------------------------------------------------------------
                SceneGlobals.ReferenceSystem.Offset += parentObject.Position - SceneGlobals.ReferenceSystem.Position;
                goto LOOPEND;

            case 0x0d:
// Set Reference ------------------------------------------------------------------------------------------------------------
                SceneGlobals.map_core.CurrentSystem = new ReferenceSystem(parentObject.Position);
                goto LOOPEND;

            case 0x0e:
// Lock Reference -----------------------------------------------------------------------------------------------------------
                Vector3     offset    = Vector3.zero;
                SceneObject scene_obj = parentObject as SceneObject;
                if (parentObject is SceneObject)
                {
                    offset = SceneGlobals.ReferenceSystem.Position - scene_obj.Position;
                    SceneGlobals.ReferenceSystem = new ReferenceSystem(scene_obj);
                }
                else if (parentObject is ITargetable)
                {
                    offset = SceneGlobals.ReferenceSystem.Position - parentObject.Position;
                    Target tgt = (parentObject as ITargetable).Associated;
                    SceneGlobals.ReferenceSystem = new ReferenceSystem(tgt);
                }

                SceneGlobals.ReferenceSystem.Offset = offset;
                goto LOOPEND;

            case 0x0f:
// Lock & Set ---------------------------------------------------------------------------------------------------------------
                if (parentObject is SceneObject)
                {
                    SceneGlobals.ReferenceSystem = new ReferenceSystem(parentObject as SceneObject);
                }
                else if (parentObject is ITargetable)
                {
                    SceneGlobals.ReferenceSystem = new ReferenceSystem((parentObject as ITargetable).Associated);
                }
                goto LOOPEND;

            case 0x19:
// Match Velocity Closest ---------------------------------------------------------------------------------------------------
                if (parentObject is ITargetable)
                {
                    foreach (IMarkerParentObject impo in MapCore.Active.selection)
                    {
                        Ship ship01 = impo as Ship;
                        if (ship01 != null && ship01.Friendly)
                        {
                            ship01.low_ai.MatchVelocityNearTarget((parentObject as ITargetable).Associated);
                        }
                    }
                }
                goto LOOPEND;

            case 0x1a:
// Match Velocity -----------------------------------------------------------------------------------------------------------
                if (parentObject is IPhysicsObject)
                {
                    foreach (IMarkerParentObject impo in MapCore.Active.selection)
                    {
                        Ship ship01 = impo as Ship;
                        if (ship01 != null && ship01.Friendly)
                        {
                            ship01.low_ai.MatchVelocity((parentObject as ITargetable).Associated);
                        }
                    }
                }
                goto LOOPEND;

            case 0x1b:
// Attack -------------------------------------------------------------------------------------------------------------------
                if (parentObject is ITargetable)
                {
                    Target self_tgt = (parentObject as ITargetable).Associated;
                    foreach (IMarkerParentObject impo in MapCore.Active.selection)
                    {
                        Ship ship01 = impo as Ship;
                        if (ship01 != null && ship01.Friendly)
                        {
                            ship01.low_ai.Attack(self_tgt);
                        }
                    }
                }
                goto LOOPEND;

            case 0x1c:
// TurretAttack -------------------------------------------------------------------------------------------------------------
                if (parentObject is ITargetable)
                {
                    Target self_tgt = (parentObject as ITargetable).Associated;
                    foreach (IMarkerParentObject impo in MapCore.Active.selection)
                    {
                        Ship ship01 = impo as Ship;
                        if (ship01 != null && ship01.Friendly)
                        {
                            ship01.low_ai.TurretAttack(self_tgt);
                        }
                    }
                }
                goto LOOPEND;

            case 0x1d:
// Aim Here -----------------------------------------------------------------------------------------------------------------
                SceneGlobals.Player.TurretAim = parentObject;
                goto LOOPEND;

            case 0x1e:
// Target Part --------------------------------------------------------------------------------------------------------------

                goto LOOPEND;

            case 0x1f:
// Set Target ---------------------------------------------------------------------------------------------------------------
                if (parentObject is ITargetable)
                {
                    Target tgt = (parentObject as ITargetable).Associated;
                    SceneGlobals.Player.Target = tgt;
                }
                goto LOOPEND;

//  +-----------------------------------------------------------------------------------------------------------------------+
//  |										Info																			|
//  +-----------------------------------------------------------------------------------------------------------------------+
            case 0x2e:
// Ship Information ---------------------------------------------------------------------------------------------------------
                if (i != 0)
                {
                    goto LOOPEND;
                }
                concerned.SpawnChild("Ship Information", new string [] {
                    ship.Mass.ToString("Mass: 0.0 t"),
                    string.Format("HP: {0:0.0} / {1:0.0}", ship.HP, ship.tot_hp),
                });
                goto LOOPEND;

            case 0x2f:
// OS -----------------------------------------------------------------------------------------------------------------------
                goto LOOPEND;
//  +-----------------------------------------------------------------------------------------------------------------------+
//  |									Command																				|
//  +-----------------------------------------------------------------------------------------------------------------------+

// Match Velocity Closest ---------------------------------------------------------------------------------------------------
            case 0x29:

                goto LOOPEND;

// Match Velocity -----------------------------------------------------------------------------------------------------------
            case 0x3a:

                goto LOOPEND;

            case 0x3b:
// Flee ---------------------------------------------------------------------------------------------------------------------
                ship.low_ai.Flee();
                goto LOOPEND;

            case 0x3c:
// Idle ---------------------------------------------------------------------------------------------------------------------
                ship.low_ai.Idle();
                goto LOOPEND;

            case 0x3d:
// Attack -------------------------------------------------------------------------------------------------------------------

                goto LOOPEND;

            case 0x3e:
// TurretAttack -------------------------------------------------------------------------------------------------------------

                goto LOOPEND;

            case 0x3f:
// Control ------------------------------------------------------------------------------------------------------------------
                if (parentObject is Ship)
                {
                    SceneGlobals.Player = parentObject as Ship;
                }
                goto LOOPEND;

            default: goto LOOPEND;
            }
            LOOPEND :;
        }
    }