Esempio n. 1
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     if (!Ship.Equals("none", StringComparison.OrdinalIgnoreCase))
     {
         var p = runtime.Player;
         if (p.Game.GameData.TryGetLoadout(Loadout, out var loadout))
         {
             p.Character.Ship  = p.Game.GameData.GetShip(Ship);
             p.Character.Items = new List <NetCargo>();
             foreach (var equip in loadout.Equip)
             {
                 var e = p.Game.GameData.GetEquipment(equip.Nickname);
                 if (e == null)
                 {
                     continue;
                 }
                 p.Character.Items.Add(new NetCargo()
                 {
                     Equipment = e,
                     Hardpoint = equip.Hardpoint,
                     Health    = 1f,
                     Count     = 1
                 });
             }
         }
     }
 }
Esempio n. 2
0
 public void SetAsMissionBase(MissionScript missionScript, int baseNumber)
 {
     isFriendly      = false;
     isMission       = true;
     this.baseNumber = baseNumber;
     mission         = missionScript;
 }
        public override void Invoke(MissionRuntime runtime, MissionScript script)
        {
            var sol  = script.Solars[Solar];
            var arch = sol.Archetype;

            runtime.Player.WorldAction(() => { runtime.Player.World.SpawnSolar(sol.Nickname, arch, sol.Loadout, sol.Position, sol.Orientation); });
        }
Esempio n. 4
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     if (Music != null)
     {
         runtime.Player.PlayMusic(Music);
     }
 }
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     if (script.Ships.ContainsKey(Target))
     {
         runtime.Player.WorldAction(() => { runtime.Player.World.NPCs.Despawn(runtime.Player.World.GameWorld.GetObject(Target)); });
     }
 }
Esempio n. 6
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     foreach (var ship in script.GetShipsByLabel(Label))
     {
         SetVibe(runtime, ship.Nickname, Ship, Vibe);
     }
 }
Esempio n. 7
0
        public override void Invoke(MissionRuntime runtime, MissionScript script)
        {
            var dlg    = script.Dialogs[Dialog];
            var netdlg = new NetDlgLine[dlg.Lines.Count];

            for (int i = 0; i < dlg.Lines.Count; i++)
            {
                var    d     = dlg.Lines[i];
                string voice = "trent_voice";
                if (!d.Source.Equals("Player", StringComparison.OrdinalIgnoreCase))
                {
                    var src = script.Ships[d.Source];
                    var npc = script.NPCs[src.NPC];
                    voice = npc.Voice;
                }

                var hash = FLHash.CreateID(d.Line);
                runtime.EnqueueLine(hash, d.Line);
                netdlg[i] = new NetDlgLine()
                {
                    Voice = voice,
                    Hash  = hash
                };
            }
            runtime.Player.PlayDialog(netdlg);
        }
Esempio n. 8
0
        public override void Invoke(MissionRuntime runtime, MissionScript script)
        {
            var hash = FLHash.CreateID(Line);

            runtime.EnqueueLine(hash, Line);
            runtime.Player.PlayDialog(new NetDlgLine[] { new NetDlgLine()
                                                         {
                                                             Voice = Voice,
                                                             Hash  = hash
                                                         } });
        }
Esempio n. 9
0
    protected override void ImmediateReaction()
    {
        MissionScript missionUI = Transform.FindObjectOfType <MissionScript>();

        missionUI.SetMission(mission);

        if (!isHide)
        {
            missionUI.OnClickUI();
        }
    }
Esempio n. 10
0
    public void InitValues(int IndexInScrollList, MissionScript newMission)
    {
        btnIndex = IndexInScrollList;
        mission = newMission;

        nameTxtObj = Instantiate(TextPrefab, new Vector3(30, -10, 0), new Quaternion(0, 0, 0, 0)) as GameObject;
        nameTxtObj.transform.SetParent(this.gameObject.transform, false);
        nameTxt = nameTxtObj.GetComponent<Text>();

        typeTxtObj = Instantiate(TextPrefab, new Vector3(30, -50, 0), new Quaternion(0, 0, 0, 0)) as GameObject;
        typeTxtObj.transform.SetParent(this.gameObject.transform, false);
        typeTxt = typeTxtObj.GetComponent<Text>();

        timeTxtObj = Instantiate(TextPrefab, new Vector3(250, -10, 0), new Quaternion(0, 0, 0, 0)) as GameObject;
        timeTxtObj.transform.SetParent(this.gameObject.transform, false);
        timeTxt = timeTxtObj.GetComponent<Text>();

        difficultyTxtObj = Instantiate(TextPrefab, new Vector3(170, -50, 0), new Quaternion(0, 0, 0, 0)) as GameObject;
        difficultyTxtObj.transform.SetParent(this.gameObject.transform, false);
        difficultyTxt = difficultyTxtObj.GetComponent<Text>();

        xpTxtObj = Instantiate(TextPrefab, new Vector3(250, -50, 0), new Quaternion(0, 0, 0, 0)) as GameObject;
        xpTxtObj.transform.SetParent(this.gameObject.transform, false);
        xpTxt = xpTxtObj.GetComponent<Text>();

        moneyTxtObj = Instantiate(TextPrefab, new Vector3(320, -50, 0), new Quaternion(0, 0, 0, 0)) as GameObject;
        moneyTxtObj.transform.SetParent(this.gameObject.transform, false);
        moneyTxt = moneyTxtObj.GetComponent<Text>();

        ActionBtnObj = this.gameObject;
        ActionBtn = ActionBtnObj.GetComponent<Button>();
        if (mission.GetMissionState() == MissionScript.MissionState.Completed || mission.GetMissionState() == MissionScript.MissionState.Failed)
        {
            ActionBtn.onClick.AddListener(() => gameManagerScript.TurnInMission(btnIndex));
        } else {
            ActionBtn.onClick.AddListener(() => gameManagerScript.SelectMission(btnIndex));
        }

        nameTxt.text = mission.GetMissionName();
        typeTxt.text = mission.GetMissionType().ToString();

        float temp = Mathf.Round(mission.GetTimeRemaining());
        if (temp == 0) { timeTxt.text = mission.GetMissionState().ToString(); }
        else { timeTxt.text = temp.ToString() + " seconds"; }

        difficultyTxt.text = mission.GetDifficulty().ToString();
        xpTxt.text = mission.GetXP().ToString() + "xp";
        moneyTxt.text = "£" + mission.GetMoney().ToString();

        GameManager = GameObject.FindGameObjectWithTag("GameManager");
        gameManagerScript = GameManager.GetComponent<GameManagerScript>();
    }
Esempio n. 11
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     runtime.Player.WorldAction(() =>
     {
         var fuse    = runtime.Player.World.Server.GameData.GetFuse(Fuse);
         var gameObj = runtime.Player.World.GameWorld.GetObject(Target);
         if (!gameObj.TryGetComponent <SFuseRunnerComponent>(out var fr))
         {
             fr = new SFuseRunnerComponent(gameObj);
             gameObj.Components.Add(fr);
         }
         fr.Run(fuse);
     });
 }
Esempio n. 12
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     FLLog.Info("Act_CallThorn", Thorn);
     runtime.Player.WorldAction(() =>
     {
         int mainObject = 0;
         if (MainObject != null)
         {
             var gameObj = runtime.Player.World.GameWorld.GetObject(MainObject);
             mainObject  = gameObj?.NetID ?? 0;
         }
         FLLog.Info("Server", $"Calling Thorn {Thorn} with mainObject `{mainObject}`");
         runtime.Player.CallThorn(Thorn, mainObject);
     });
 }
Esempio n. 13
0
        public override void Invoke(MissionRuntime runtime, MissionScript script)
        {
            var netdlg = new NetDlgLine[1];
            var src    = script.Ships[Source];
            var npc    = script.NPCs[src.NPC];
            var voice  = npc.Voice;
            var hash   = FLHash.CreateID(Line);

            runtime.EnqueueLine(hash, Line);
            netdlg[0] = new NetDlgLine()
            {
                Voice = voice,
                Hash  = hash
            };
            runtime.Player.PlayDialog(netdlg);
        }
        public override void Invoke(MissionRuntime runtime, MissionScript script)
        {
            var form = script.Formations[Formation];
            var fpos = Position ?? form.Position;

            SpawnShip(form.Ships[0], fpos, form.Orientation, null, script, runtime);
            var mat = Matrix4x4.CreateFromQuaternion(form.Orientation) *
                      Matrix4x4.CreateTranslation(fpos);
            int j = 0;

            for (int i = 1; i < form.Ships.Count; i++)
            {
                var pos = Vector3.Transform(formationOffsets[j++], mat);
                SpawnShip(form.Ships[i], pos, form.Orientation, null, script, runtime);
            }
        }
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     if (Ship.Equals("player", StringComparison.OrdinalIgnoreCase))
     {
         runtime.Player.RemoteClient.ForceMove(Position);
     }
     else if (script.Ships.ContainsKey(Ship))
     {
         runtime.Player.WorldAction(() =>
         {
             var obj  = runtime.Player.World.GameWorld.GetObject(Ship);
             var quat = Quaternion ?? obj.LocalTransform.ExtractRotation();
             obj.SetLocalTransform(Matrix4x4.CreateFromQuaternion(quat) * Matrix4x4.CreateTranslation(Position));
         });
     }
 }
Esempio n. 16
0
        public override void Invoke(MissionRuntime runtime, MissionScript script)
        {
            var ol = script.ObjLists[List].Construct();

            if (script.Ships.ContainsKey(Target))
            {
                runtime.Player.World.NPCs.NpcDoAction(Target,
                                                      (npc) => { npc.GetComponent <SNPCComponent>().SetState(ol); });
            }
            else if (script.Formations.TryGetValue(Target, out var formation))
            {
                foreach (var s in formation.Ships)
                {
                    runtime.Player.World.NPCs.NpcDoAction(s,
                                                          (npc) => { npc.GetComponent <SNPCComponent>().SetState(ol); });
                }
            }
        }
Esempio n. 17
0
    IEnumerator Wating()
    {
        MissionScript mission = GameObject.FindObjectOfType <MissionScript>();

        mission.isClicked = false;

        while (true)
        {
            yield return(null);

            if (mission.isClicked == true)
            {
                afterReaction.InitAndReact();
                break;
            }
        }

        Destroy(myCorotine);
    }
Esempio n. 18
0
    public override void OnInspectorGUI()
    {
        ThisScript = (MissionScript)target;



        if (ThisScript.AllUnitsCanUse.Length < 1 || ThisScript.AllWeaponCanUse.Length < 1)
        {
            if (ThisScript._emptyPrefabOfUnit != null && ThisScript._emptyPrefabOfWeapon != null)
            {
                ThisScript.LoadDataFromRes();
            }

            base.OnInspectorGUI();
        }
        else
        {
            ChooseEnemy(ThisScript.AllWeaponCanUse, ThisScript.AllUnitsCanUse);
        }
    }
Esempio n. 19
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     runtime.Player.Character.UpdateCredits(runtime.Player.Character.Credits + Amount);
 }
Esempio n. 20
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     SetVibe(runtime, Target, Other, Vibe);
 }
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     SpawnShip(Ship, Position, Orientation, ObjList, script, runtime);
 }
Esempio n. 22
0
 public void SetAsMission(MissionScript mission)
 {
     this.mission = mission;
 }
        protected void SpawnShip(string msnShip, Vector3?spawnpos, Quaternion?spawnorient, string objList, MissionScript script, MissionRuntime runtime)
        {
            var ship   = script.Ships[msnShip];
            var npcDef = script.NPCs[ship.NPC];

            script.NpcShips.TryGetValue(npcDef.NpcShipArch, out var shipArch);

            if (shipArch == null)
            {
                shipArch = runtime.Player.Game.GameData.Ini.NPCShips.ShipArches.First(x =>
                                                                                      x.Nickname.Equals(npcDef.NpcShipArch, StringComparison.OrdinalIgnoreCase));
            }

            var     pos    = spawnpos ?? ship.Position;
            var     orient = spawnorient ?? ship.Orientation;
            AiState state  = null;

            if (!string.IsNullOrEmpty(objList))
            {
                state = script.ObjLists[objList].Construct();
            }

            runtime.Player.WorldAction(() =>
            {
                runtime.Player.World.Server.GameData.TryGetLoadout(shipArch.Loadout, out var ld);
                var pilot = runtime.Player.World.Server.GameData.GetPilot(shipArch.Pilot);
                var obj   = runtime.Player.World.NPCs.DoSpawn(ship.Nickname, ld, pilot, pos, orient);
                obj.GetComponent <SNPCComponent>().SetState(state);
            });
        }
Esempio n. 24
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     runtime.DeactivateTrigger(Trigger);
 }
Esempio n. 25
0
 public abstract void Invoke(MissionRuntime runtime, MissionScript script);
Esempio n. 26
0
    // TEST To be replaced
    MissionScript GenerateRandomMission()
    {
        MissionScript.MissionType mType = MissionScript.MissionType.Agility;
        int diff = Random.Range(1, 5);

        float time = diff + Random.Range(1, 19);

        switch (Random.Range(0,3)) {
            case 0:
                mType = MissionScript.MissionType.Agility;
                break;
            case 1:
                mType = MissionScript.MissionType.Strength;
                break;
            case 2:
                mType = MissionScript.MissionType.Willpower;
                break;
        }

        MissionScript mission = new MissionScript("Beginner Mission", diff, mType, time);
        return mission;
    }
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     runtime.Player.RemoteClient.ForceMove(Position);
 }
Esempio n. 28
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     runtime.Player.AddRTC(RTC);
 }
Esempio n. 29
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     runtime.Player.PlaySound(Effect);
 }
Esempio n. 30
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     runtime.Player.CallThorn(null, 0);
 }
Esempio n. 31
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     runtime.Player.ForceLand(Base);
 }
Esempio n. 32
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     runtime.Player.RemoteClient.PopupOpen(Title, Contents, ID);
 }