public void UseButton()
    {
        if (ContextManagerGamePro.Instance().selectedship.Faction != FactionEnum.Pirate)
        {
            return;
        }

        status = !status;

        if (status)
        {
            if (weapon)
            {
                if (ContextManagerGamePro.Instance().selectedship)
                {
                    weapon.target = ContextManagerGamePro.Instance().selectedship.transform;
                }
            }
        }
        else
        {
            if (weapon)
            {
                weapon.target = null;
            }
        }
    }
Exemple #2
0
 // This function is called when the MonoBehaviour will be destroyed
 public void OnDestroy()
 {
     if (ContextManagerGamePro.Instance().loca.Contains(this))
     {
         ContextManagerGamePro.Instance().loca.Remove(this);
     }
 }
Exemple #3
0
    private void LangDropdownValueChangeHandler(Dropdown target)
    {
        PlayerPrefs.SetInt("LangInt", target.value);
        switch (target.value)
        {
        case 0:
            PlayerPrefs.SetString("Lang", "English");
            break;

        case 1:
            PlayerPrefs.SetString("Lang", "Russian");
            break;

        default:
            PlayerPrefs.SetString("Lang", "English");
            break;
        }
        PlayerPrefs.Save();
        Debug.Log("Lang set in: " + PlayerPrefs.GetInt("Lang"));
        if (!ContextManagerGamePro.Instance())
        {
            return;
        }
        for (int i = 0; i < ContextManagerGamePro.Instance().loca.Count; i++)
        {
            ContextManagerGamePro.Instance().loca[i].CreateText();
        }
    }
Exemple #4
0
    public static void LoadProfile()
    {
        //загрузка данных профиля
        Profile  profile = ContextManagerGamePro.Instance().Profile;
        JsonData data    = DataLoad(profile);

        profile.Day     = (int)data["Day"];
        profile.credits = (int)data["ProfileStats"][0];
        profile.fame    = (int)data["ProfileStats"][1];
        if (ContextManagerGamePro.Instance().Profile.isTutorialPart1 == true)
        {
            profile.isTutorialPart1 = (bool)data["isTutorialPart1"];
        }
        profile.isTutorialPart2 = (bool)data["isTutorialPart2"];
        profile.isTutorialPart3 = (bool)data["isTutorialPart3"];

        StationUI UI = GameObject.Find("StationUI").GetComponent <StationUI>();
        Transform stationinventory = UI.stationinventory.transform.GetChild(0).transform.GetChild(0);

        for (int i = 0; i < data["Items"].Count; i++)
        {
            GameObject item = Instantiate(Resources.Load("items/" + data["Items"][i]["itemID"].ToString()) as GameObject);
            item.GetComponent <Item>().stackvalue = (int)data["Items"][i]["value"];
            item.transform.SetParent(stationinventory);
            item.transform.localScale = Vector3.one;
        }
    }
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.R))
     {
         playership = ContextManagerGamePro.Instance().playership;
         playership.shieldregenbool = !playership.shieldregenbool;
     }
 }
    public void OnEnable()
    {
        profile = ContextManagerGamePro.Instance().Profile;

        profilename.text = profile.profilename;
        credits.text     = profile.credits.ToString();
        fame.text        = profile.fame.ToString();
    }
Exemple #7
0
    public void ToStation()
    {
        GameObject obj = GameObject.Find("GameContext");

        ContextManagerGamePro.Instance().playership.transform.SetParent(obj.transform.GetChild(0).transform);
        ContextManagerGamePro.Instance().navpoint = Vector3.zero;
        SceneManager.LoadScene("Station");
    }
Exemple #8
0
 void Start()
 {
     if (!isRuntime)
     {
         ContextManagerGamePro.Instance().loca.Add(this);
         CreateText();
     }
 }
Exemple #9
0
 void Start()
 {
     minimapcamera = Instantiate(minimapcamera);
     ContextManagerGamePro.Instance().SpaceUi = this;
     // canvas.worldCamera = maincamera;
     // canvas.planeDistance = 1;
     Invoke("UpdateModulePanel", 1f);
 }
Exemple #10
0
 public void RegenShieldButton()
 {
     if (!ContextManagerGamePro.Instance().playership)
     {
         return;
     }
     ContextManagerGamePro.Instance().playership.shieldregenbool = !ContextManagerGamePro.Instance().playership.shieldregenbool;
 }
Exemple #11
0
 void OnDestroy()
 {
     if (isPlayerShip)
     {
         ContextManagerGamePro.Instance().playership = null;
     }
     // conteiner.SetActive(true);
     // conteiner.transform.SetParent(null);
 }
Exemple #12
0
 void Start()
 {
     if (generete)
     {
         SceneName  = ContextManagerGamePro.Instance().loadedmission.ID;
         SceneLevel = ContextManagerGamePro.Instance().loadedmission.danger;
         SceneFame  = ContextManagerGamePro.Instance().loadedmission.fame;
     }
 }
Exemple #13
0
 public void Defeat()
 {
     if (ContextManagerGamePro.Instance().playership != null)
     {
         return;
     }
     ContextManagerGamePro.Instance().PreviousScene = scene.SceneName;
     SceneManager.LoadScene("Station");
 }
Exemple #14
0
 void Start()
 {
     profile           = ContextManagerGamePro.Instance().Profile;
     CargoOpen         = false;
     stationinventory  = gameObject.transform.Find("StationInventory").gameObject;
     WeaponSlotPanel   = gameObject.transform.Find("ShipEqipPanel/WeaponSlotPanel").gameObject;
     EngineerSlotPanel = gameObject.transform.Find("ShipEqipPanel/EngineerSlotPanel").gameObject;
     PlayerActualShip  = gameObject.transform.Find("PlayerActualShip").gameObject;
     AddShip();
 }
Exemple #15
0
    private void CreateProfileObj(string name)
    {
        GameObject profileobj = new GameObject();

        profileobj.name = "Profile";
        profileobj.AddComponent <Profile>();
        Profile created = profileobj.GetComponent <Profile>();

        created.profilename = name;
        ContextManagerGamePro.Instance().Profile = created;
    }
Exemple #16
0
 public void TakeItem()
 {
     if (ContextManagerGamePro.Instance().playership.cargo.curVolume < ContextManagerGamePro.Instance().playership.cargo.Volume)
     {
         transform.SetParent(GameObject.Find("GameContext").transform.GetChild(1));
         transform.position = Vector3.zero;
     }
     else
     {
         transform.SetParent(originparent);
     }
 }
Exemple #17
0
    public void Dead()
    {
        agent.destination = new Vector3(0, 0, 0);

        if (ContextManagerGamePro.Instance().unitslist.Contains(this))
        {
            ContextManagerGamePro.Instance().unitslist.Remove(this);
        }

        Destroy(this.gameObject);
        Debug.Log("Unit " + unitname + " dead!");
    }
Exemple #18
0
    void Load()
    {
        ContextManagerGamePro.Instance().StaticMetods.LoadProfileData();

        StationUI ui = GameObject.Find("StationUI").GetComponent <StationUI>();

        if (ui.PlayerActualShip.transform.childCount > 0)
        {
            return;
        }
        ContextManagerGamePro.Instance().StaticMetods.LoadShipData();
    }
Exemple #19
0
    // This function is called when the object becomes enabled and active
    public void OnEnable()
    {
        if (!isRuntime || manual)
        {
            return;
        }
        if (!ContextManagerGamePro.Instance().loca.Contains(this))
        {
            ContextManagerGamePro.Instance().loca.Add(this);
        }

        CreateText();
    }
Exemple #20
0
    public void Selection(Select select)
    {
        switch (select.SelectType)
        {
        case Select.selecttype.Ship:
            ContextManagerGamePro.Instance().selectedship = select.ship;
            ContextManagerGamePro.Instance().SelectedType = Select.selecttype.Ship;
            break;

        default:
            break;
        }
    }
Exemple #21
0
    public void CreateText(string ID)
    {
        Text textfield = GetComponent <Text>();

        langType = PlayerPrefs.GetString("Lang");
        try
        {
            textfield.text = ContextManagerGamePro.Instance().ResourceManager.LocalizationData["Localization"][ID][langType].ToString();
        }
        catch
        {
            textfield.text = Id;
        }
    }
Exemple #22
0
    public void UseButtonRm()
    {
        if (ContextManagerGamePro.Instance().selectedship.Faction != FactionEnum.Pirate)
        {
            return;
        }

        if (weapon)
        {
            if (ContextManagerGamePro.Instance().selectedship)
            {
                weapon.target = ContextManagerGamePro.Instance().selectedship.transform;
            }
        }
    }
Exemple #23
0
    public void OnFinal()
    {
        GameObject obj = GameObject.Find("GameContext");

        SceneBuilder scene = GameObject.Find("Scene").GetComponent <SceneBuilder>();

        ContextManagerGamePro.Instance().playership.transform.SetParent(obj.transform.GetChild(0).transform);
        ContextManagerGamePro.Instance().navpoint = Vector3.zero;
        ContextManagerGamePro.Instance().PreviousScene = scene.SceneName;
        ContextManagerGamePro.Instance().Profile.fame += scene.SceneFame;
        ContextManagerGamePro.Instance().playership.HP = ContextManagerGamePro.Instance().playership.maxHP;
        ContextManagerGamePro.Instance().playership.shield = 0;
        SceneManager.LoadScene("Station");

        Debug.Log("MISSION END ...... LOAD STATION!");
    }
Exemple #24
0
    private void SetupProfile()
    {
        var g = ContextManagerGamePro.Instance();
        var needToCreateProfile = true;

        if (g.Profile != null)
        {
            needToCreateProfile = DoSomeThingWithPreviousProfile();
        }

        if (needToCreateProfile)
        {
            var p = Instantiate(Resources.Load <GameObject>("Profile"));
            g.Profile = p.GetComponent <Profile>();
        }
    }
Exemple #25
0
    public void AddShip()
    {
        GameObject shipcontextobj = GameObject.Find("GameContext").transform.GetChild(0).gameObject;

        if (PlayerActualShip.transform.childCount > 0)
        {
            ship = PlayerActualShip.transform.GetChild(0).gameObject.GetComponent <Ship>();
            ContextManagerGamePro.Instance().playership = ship;
        }
        else if (shipcontextobj.transform.childCount > 0)
        {
            ship = shipcontextobj.transform.GetChild(0).gameObject.GetComponent <Ship>();
            ship.gameObject.transform.SetParent(PlayerActualShip.transform);
            ContextManagerGamePro.Instance().playership = ship;
        }
    }
Exemple #26
0
    void Start()
    {
        scene = gameObject.GetComponent <SceneBuilder>();
        LoadBattleUI();
        InvokeRepeating("WinCondition", 0, 1f);
        InvokeRepeating("Defeat", 0, 1f);


        if (generete)
        {
            foreach (string id in ContextManagerGamePro.Instance().loadedmission.dropitems)
            {
                Debug.Log(id);
                dropitems.Add(Instantiate((Resources.Load("items/" + id)) as GameObject));
            }
        }
    }
Exemple #27
0
    public void LoadMission()
    {
        GameObject PlayerActualShip = GameObject.Find("PlayerActualShip").gameObject;

        ContextManagerGamePro.Instance().loadedmission = this;

        GameObject shipcontextobj = GameObject.Find("GameContext").transform.GetChild(0).gameObject;

        Debug.Log(shipcontextobj.name);
        PlayerActualShip.transform.GetChild(0).transform.SetParent(shipcontextobj.transform);

        if (randomitem)
        {
            dropitems.AddRange(ContextManagerGamePro.Instance().StaticMetods.GetItemFromList(itemrar, randomitemcountMax));
        }

        SceneManager.LoadScene(ID);
    }
Exemple #28
0
 void StatusColour()
 {
     if (weapon.isReload)
     {
         statusimage.color = Color.yellow;
     }
     else
     {
         if (ContextManagerGamePro.Instance().selectedship == null || ContextManagerGamePro.Instance().selectedship.Faction != FactionEnum.Pirate)
         {
             statusimage.color = Color.red;
         }
         if (ContextManagerGamePro.Instance().selectedship.Faction == FactionEnum.Pirate)
         {
             statusimage.color = Color.green;
         }
     }
 }
Exemple #29
0
 void StartTutorial()
 {
     if (ContextManagerGamePro.Instance().Profile.isTutorialPart1)
     {
         tutorialdialog1.SetActive(true);
         return;
     }
     else if (ContextManagerGamePro.Instance().Profile.isTutorialPart2)
     {
         // tutorialdialog2.SetActive(true);
         return;
     }
     else if (ContextManagerGamePro.Instance().Profile.isTutorialPart3)
     {
         // tutorialdialog3.SetActive(true);
         return;
     }
 }
Exemple #30
0
    // Update is called once per frame
    void Update()
    {
        if (ContextManagerGamePro.Instance().selectedship == null || ContextManagerGamePro.Instance().selectedship.Faction != FactionEnum.Pirate)
        {
            thisbutton.interactable = false;
            status = false;
            return;
        }

        if (ContextManagerGamePro.Instance().SelectedType == Select.selecttype.Ship)
        {
            thisbutton.interactable = true;
        }
        else
        {
            thisbutton.interactable = false;
        }

        StatusColour();
    }