Inheritance: MonoBehaviour
Exemplo n.º 1
0
 void Awake()
 {
     players = new List <Player>();
     current_player_index  = 0;
     current_movement_path = new Stack <Tile>();
     instance = this;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Keeping this around in case I support more mods that have helmets. It parses all the extracted XComHelmetContent files in a directory and generates a
        /// text file that has custom information on which helmets block things like hair and facial props
        /// </summary>
        /// <param name="rawHelmetFilesRootDir">The top level directory of the extracted files from the XCOM Editor</param>
        /// <param name="outputFilePath">The consolidated output text file location</param>
        static void ParseHelmetInfo(string rawHelmetFilesRootDir, string outputFilePath)
        {
            var overlord = new Overlord();

            overlord.LoadCustomizationTemplates();
            var files = new DirectoryInfo(rawHelmetFilesRootDir).GetFiles("*", SearchOption.AllDirectories);

            var sb = new StringBuilder();

            foreach (var file in files)
            {
                var lines = File.ReadAllLines(file.FullName).Where(l => !string.IsNullOrEmpty(l)).Select(l => l.Trim().Replace("\"", "").Split('=')).Where(l => l.Length > 1).ToList();

                string arcName        = $"{file.Directory.Name}.{lines.First(l => l[0] == "Name")[1]}";
                bool   hideHair       = !lines.Any(l => l[0] == "FallbackHairIndex");
                bool   hideUpper      = lines.Any(l => l[0] == "bHideUpperFacialProps");
                bool   hideLower      = lines.Any(l => l[0] == "bHideLowerFacialProps");
                bool   hideFacialHair = lines.Any(l => l[0] == "bHideFacialHair");

                var matchingTemplate = overlord.Templates.First(t => t.ArchetypeName?.Equals(arcName, StringComparison.OrdinalIgnoreCase) ?? false);

                sb.AppendLine($"{matchingTemplate.Name}={(hideHair ? "" : "!")}HideHair,{(hideUpper ? "" : "!")}HideUpperFaceProps,{(hideLower ? "" : "!")}HideLowerFaceProps,{(hideFacialHair ? "" : "!")}HideFacialHair");
            }

            File.WriteAllText(outputFilePath, sb.ToString());
        }
Exemplo n.º 3
0
    protected override void Start()
    {
        Overlord o = FindObjectOfType <Overlord>();

        if (o != null)
        {
            foreach (Item item in o.inventory)
            {
                for (int i = 0; i < item.abilities.Length; i++)
                {
                    abilities.Add(item.abilities[i].ability);
                }

                this.strength   += item.stats.strength;
                this.energy     += item.stats.energy;
                this.endurance  += item.stats.endurance;
                this.resilience += item.stats.resilience;
            }
        }

        this.health = PlayerPrefs.GetInt("player_health", 100);
        if (this.health <= 0)
        {
            this.health = 100;
        }

        base.Start();
    }
Exemplo n.º 4
0
 void Awake()
 {
     players = new List<Player>();
     current_player_index = 0;
     current_movement_path = new Stack<Tile>();
     instance = this;
 }
Exemplo n.º 5
0
    public void GetReward()
    {
        _o = Overlord._instance;

        if (_o.currentEvent == null)
        {
            _o.currentEvent = _o.GetRandomEvent(Overlord.EventTypes.TREASURE);
        }

        animate     = true;
        shake_timer = _SHAKE_TIME_;
        GetComponent <Button>().interactable = false;

        Item i = _o.currentEvent.rewards[Random.Range(0, _o.currentEvent.rewards.Length)];

        Debug.Log(i.name);

        item.GetComponent <Image>().sprite = i.artwork;
        Text t = item.transform.Find("Text").GetComponent <Text>();

        t.text = string.Format(_TREASURE_TEXT_, i.name, i.description);
        if (_o.inventorySlots <= _o.inventory.Count)
        {
            t.text += "\nYou can't carry more objects. Leaving this treasure behind drives you more insane.";
        }

        _o.InventoryAdd(i);
    }
Exemplo n.º 6
0
        private LogicNode CreateLogic(XmlNode node, Overlord overlord)
        {
            if (overlord.LogicConstructorInfos.ContainsKey(node.Name) == false)
            {
                throw new Exception("Logic class not found for " + node.Name);
            }

            List <object> args = new List <Object> {
                node
            };

            if (overlord.LogicConstructorInfos [node.Name].ContainsLogic)
            {
                args.Add(new CreateLogicVessel(CreateLogic, overlord));
            }

            if (overlord.LogicConstructorInfos [node.Name].ContainsExpressions)
            {
                args.Add(overlord.ExpressionConstructorInfos);
            }

            LogicNode logic = (LogicNode)Activator.CreateInstance(overlord.LogicConstructorInfos [node.Name].Type, args.ToArray());

            return(logic);
        }
Exemplo n.º 7
0
    public void init(Overlord o, int vx)
    {
        overlord = o;
        worth    = vx;
        if (overlord == null)
        {
            overlordSetup();
        }
        else
        {
            active = true;
        }

        myUI = Instantiate(UI);
        try
        {
            myUI.GetComponent <InGameItemUI>().init();
            myUI.transform.SetParent(this.transform);
            myUI.transform.position = this.transform.position;
            myUI.transform.Translate(0, 0, -3f);
            myUI.SetActive(false);
        }
        catch (System.Exception e)
        {
            Debug.LogError("@Morgan - Red alert, This function is busted at the init call!");
        }
    }
Exemplo n.º 8
0
    /*TODO:
     *
     * Slection currently hard coded for only player units, needs to work for enemy too
     *
     *
     *
     *
     *
     */


    //Class Constructor
    public virtual void Init(Generator mainmap, Overlord overlor, Vector2 loc)
    {
        //set cross variables
        mainMap  = mainmap;
        overlord = overlor;
        stdMath  = mainmap.stdMath;
        Random.InitState(stdMath.seed);

        //Initialize Character Controller
        anim = this.gameObject.GetComponent <Animator> ();
        //con = this.gameObject.AddComponent<CharacterController> ();
        //con.slopeLimit = 90;
        //con.center = new Vector3 (0, 1, 0);

        //set sight plane size
        tileLocation = loc;

        //set default layers
        defaultLayer        = overlord.defualtLayer;
        defaultLayerOutline = overlord.defualtLayerOutline;

        //set friendly/enemy status
        baseStats.overlord = overlor;
        baseStats.isEnemy  = !overlor.activePlayer;
    }
Exemplo n.º 9
0
        public override void LoadGame(Game game, Overlord overlord, XmlNode root)
        {
            XmlNode vars = root ["CustomVars"];

            UniqueList <string> existing = new UniqueList <string> ("Duplicate custom var {{}}");

            for (var i = 0; i < vars.ChildNodes.Count; i++)
            {
                XmlNode v = vars.ChildNodes [i];
                XmlAttributeCollection attrs = v.Attributes;
                string name = attrs ["name"].Value;

                existing.Add(name);

                CustomVar customVar = null;

                if (v.Name == "CustomArrayVar")
                {
                    string [] values = attrs ["values"].Value.Split(',');
                    customVar = new CustomArrayVar(name, values);
                }
                else
                {
                    string value = attrs ["value"].Value;
                    customVar = new CustomSingleVar(name, value);
                }

                game.CustomVars.Add(customVar);
            }
        }
Exemplo n.º 10
0
    public static void RegisterOverlord(Overlord _overlord)
    {
        string _name = "";

        foreach (GameObject _lobbyPlayerObj in GameObject.FindGameObjectsWithTag("LobbyPlayer"))
        {
            if (_lobbyPlayerObj != null)
            {
                LobbyPlayer _lobbyPlayer = _lobbyPlayerObj.GetComponent <LobbyPlayer>();

                if (_lobbyPlayer.playerID == _overlord.playerID)
                {
                    _name = _lobbyPlayer.name;
                }
            }
        }

        _name += "(Overlord)";
        _overlord.SetName(_name);
        overlord = _overlord;
        registeredPlayers++;
        if (registeredPlayers == connectedPlayers)
        {
            InitiatePlayer();
        }
    }
Exemplo n.º 11
0
        public PrototypesPage()
        {
            Resources.Add("Self", this);
            Resources.Add("OpenCommand", new DelegateCommand((sender) => {
                var dialog = new System.Windows.Forms.FolderBrowserDialog();
                var result = dialog.ShowDialog();
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    var aomDir = new AOMDirectory();
                    aomDir.Load(dialog.SelectedPath);
                    Overlord.FromAOMDirectory(aomDir, (log) => { });
                }
            }));
            Resources.Add("SaveCommand", new DelegateCommand((sender) => {
                MessageBox.Show("Saving doesnt work yet");

                /*var dialog = new SaveFileDialog() { };
                 * dialog.ShowDialog();*/
            }));
            Resources.Add("CloseCommand", new DelegateCommand((sender) => { }));
            Resources.Add("PrototypeImageCommand", new DelegateCommand((prototype) => {
                var unitSettings = new UnitPrototypeSettings()
                {
                    Prototype = prototype as PrototypeViewModel,
                };
                unitSettings.Show();
            }));

            InitializeComponent();

            /*if (string.IsNullOrWhiteSpace(Overlord.Directory)) {
             *  ((Storyboard)FileSourceGrid.Resources["FileSourceGridFlash"]).Begin();
             * }*/
        }
Exemplo n.º 12
0
        public override void RegisterExpressionConstructors(Overlord overlord)
        {
            overlord.ExpressionConstructorInfos.Add("Constant", new ExpressionConstructorInfo(typeof(Constant), false));

            overlord.ExpressionConstructorInfos.Add("Concatenate", new ExpressionConstructorInfo(typeof(Concatenate), false));
            overlord.ExpressionConstructorInfos.Add("RandomInt", new ExpressionConstructorInfo(typeof(RandomInt), false));
        }
Exemplo n.º 13
0
    private void Awake()
    {
        if (_instance == null)
        {
            _instance = this;
            DontDestroyOnLoad(this);
        }
        else
        {
            DestroyImmediate(gameObject);
        }

        rng = new System.Random();

        // If there are items in the inventory, add Cards to the collection if necessary.
        for (int i = 0; i < inventory.Count; i++)
        {
            Item item = inventory[i];
            for (int j = 0; j < item.cards.Length; j++)
            {
                collection.Add(item.cards[j]);
            }
        }

        currentEvent = null;
    }
Exemplo n.º 14
0
 private void LoadAOMDirectory(AOMDirectory dir)
 {
     //LoadBar.IsIndeterminate = true;
     //LoadBar.Visibility = Visibility.Visible;
     if (dir.Loaded)
     {
         TryingLoad.Visibility = Visibility.Visible;
         NotLoaded.Visibility  = Visibility.Collapsed;
         Overlord.FromAOMDirectory(dir, (log) => {
             string errors = log.ErrorsAsString, warnings = log.WarningsAsString, infos = log.InfosAsString;
             if (!string.IsNullOrWhiteSpace(errors) || !string.IsNullOrWhiteSpace(warnings) || !string.IsNullOrWhiteSpace(infos))
             {
                 string msg = "Load complete." +
                              (!string.IsNullOrWhiteSpace(errors) ? "\n\nErrors:\n" + errors : "") +
                              (!string.IsNullOrWhiteSpace(warnings) ? "\n\nWarnings:\n" + warnings : "") +
                              (!string.IsNullOrWhiteSpace(infos) ? "\n\nInfo:\n" + infos : "");
                 SetValue(MessagesProperty, msg);
                 Debug.WriteLine("Loaded AOM data from " + dir);
             }
             //LoadBar.IsIndeterminate = false;
             //LoadBar.Visibility = Visibility.Hidden;
             LoadError.Visibility     = Visibility.Collapsed;
             WindowContent.Visibility = Visibility.Visible;
         });
     }
     //((Storyboard)FileSourceGrid.Resources["FileSourceGridFlash"]).Stop();
 }
Exemplo n.º 15
0
        private void frmTemplateBrowser_Load(object sender, EventArgs e)
        {
            _overlord = new Overlord();
            _overlord.LoadCustomizationTemplates();

            var dt = new DataTable();
            using (var reader = ObjectReader.Create(_overlord.Templates))
                dt.Load(reader);
            dt.Columns["Display"].SetOrdinal(0);
            dt.Columns["Name"].SetOrdinal(1);
            dt.Columns["Gender"].SetOrdinal(2);
            dt.Columns["Race"].SetOrdinal(3);
            dt.Columns["Language"].SetOrdinal(4);
            dt.Columns["ArchetypeName"].SetOrdinal(5);
            dt.Columns["CharacterTemplate"].SetOrdinal(6);
            dt.Columns["ArmorTemplate"].SetOrdinal(7);
            dt.Columns["Veteran"].SetOrdinal(8);
            dt.Columns["CanUseOnCivilian"].SetOrdinal(9);
            dt.Columns["SpecializedType"].SetOrdinal(10);
            dt.Columns["SetNames"].SetOrdinal(11);
            dt.Columns["Tech"].SetOrdinal(12);
            dt.Columns["PartType"].SetOrdinal(13);
            dt.Columns["Origin"].SetOrdinal(14);

            templateBs.DataSource = dt;
            dgvTemplates.DataSource = templateBs;
            dgvTemplates.Columns["Index"].Visible = false;
            dgvTemplates.Columns["PartTypeLocalized"].Visible = false;
            ApplyFilter();
        }
Exemplo n.º 16
0
 private void LoadLogic(Game game, XmlNode node, Overlord overlord)
 {
     for (int i = 0; i < node.ChildNodes.Count; i++)
     {
         XmlNode n = node.ChildNodes [i];
         game.Logic.Add(CreateLogic(n, overlord));
     }
 }
Exemplo n.º 17
0
 new public void setOverlord(Overlord o)
 {
     this.overlord = o;
     this.camps    = o.environmentCore.mapSlice.camps;
     this.campSlice.setOverlord(o);
     mb1.region = 4;
     mb2.region = 5;
 }
Exemplo n.º 18
0
    public bool active = false;                         //state of the resource core
    //-----------------------------------------------------------------------------------------------------------------------------

    //called by the overlord to configure this core
    new public void setOverlord(Overlord o)
    {
        //set the overlord reference to all objects managed in this core
        this.overlord = o;
        itemSlice.setOverlord(o);
        resourceSlice.setOverlord(o);
//        shopSlice.setOverlord(o);
    }
Exemplo n.º 19
0
 //locate and cache a pointer to the resource manager
 void updateReferences()
 {
     overlord = GameObject.FindGameObjectWithTag("master").GetComponent <Overlord>();
     resCore  = overlord.resourceCore;
     itemMagr = overlord.resourceCore.itemSlice;
     resMgr   = resCore.resourceSlice;
     pls      = overlord.requestPlayerList();
 }
Exemplo n.º 20
0
 //Initialize class
 public void InitSight(Unit u, Overlord over, SphereCollider sight, float r, int tilewide)
 {
     unit        = u;
     overlord    = over;
     radius      = r;
     tileWidth   = tilewide;
     sightSphere = sight;
 }
Exemplo n.º 21
0
 public Model()
 {
     peers            = new ObservableCollection <Node>();
     shares           = new SafeObservable <Share>();
     messages         = new SafeObservable <string>();
     converstations   = new SafeObservable <Conversation>();
     transferSessions = new SafeObservable <TransferSession>();
     node             = new Node();
     overlord         = new Overlord();
 }
Exemplo n.º 22
0
 public Model()
 {
     peers = new ObservableCollection<Node>();
     shares = new SafeObservable<Share>();
     messages = new SafeObservable<string>();
     converstations = new SafeObservable<Conversation>();
     transferSessions = new SafeObservable<TransferSession>();
     node = new Node();
     overlord = new Overlord();
 }
Exemplo n.º 23
0
    //Class constructor
    public override void Init(STDMath math, Overlord over, Generator gen)
    {
        //set base controls
        base.Init(math, over, gen);

        //initialize input classes
        // mouse = this.gameObject.AddComponent<MouseInput>();
        // keys = this.gameObject.AddComponent<KeyboardInput>();
        // mouse.con = keys.con = this;
    }
Exemplo n.º 24
0
    /* Upgrades left:
     *
     * Ranger: 2,3
     *
     *
     */

    //Initializer
    public override void Init(Unit u, Overlord o, STDMath m)
    {
        base.Init(u, o, m);

        //set unit upgrade actions
        for (int i = 0; i < numUnitUpgrades; ++i)
        {
            SetUnitUpgradeAction(i, GetUnitAction(i, true), GetUnitAction(i, false));
        }
    }
Exemplo n.º 25
0
    /*
     * //disgusting little button methods
     *
     *
     * void setW1()
     * {
     *  controlsOne = 0;
     * }
     * void setI1()
     * {
     *  controlsOne = 1;
     * }
     * void setA1()
     * {
     *  controlsOne = 2;
     * }
     * void setM1()
     * {
     *  controlsOne = 3;
     * }
     *
     * void setW2()
     * {
     *  controlsTwo = 0;
     * }
     * void setI2()
     * {
     *  controlsTwo = 1;
     * }
     * void setA2()
     * {
     *  controlsTwo = 2;
     * }
     * void setM2()
     * {
     *  controlsTwo = 3;
     * }
     * // */

    public void begin()
    {
        if (!players)
        {
            Overlord.changeStage(1, controls[0], controls[1]);
        }
        else
        {
            Overlord.changeStage(2, controls[0], controls[1]);
        }
    }
Exemplo n.º 26
0
    //class constructor
    public override void Init(Generator mainmap, Overlord overlor, Vector2 loc)
    {
        //initialize unit
        base.Init(mainmap, overlor, loc);

        //Set scout base information
        SetUnitInformation();

        //initialize support classes
        InitSupportClasses();
    }
Exemplo n.º 27
0
    //Universal Initialization
    public virtual void Init(STDMath math, Overlord over, Generator gen)
    {
        //Reference cross class
        stdMath  = math;
        overlord = over;
        map      = gen;
        cam      = Camera.main;

        //initalize classes
        select = this.gameObject.AddComponent <Selector>();
        select.Init(this);
    }
Exemplo n.º 28
0
 //-------------------------------------------------------------------------
 public void seMatoEnemigo(Overlord enemigo)
 {
     if (activo)
     {
         if (enemigo == null)
         {
             _cantidadCazada++;
             tiposEnemigos.Remove(enemigo);
             Debug.Log("cantidad cazada" + _cantidadCazada);
         }
     }
 }
Exemplo n.º 29
0
    // Use this for initialization
    void Start()
    {
        _o = Overlord._instance;
        if (_o.currentEvent == null)
        {
            _o.currentEvent = _o.GetRandomEvent(Overlord.EventTypes.MERCHANT);
        }

        confirmationPanel.SetActive(false);

        RefreshInventory();
    }
Exemplo n.º 30
0
    public void init(Camp camp, Overlord ol)
    {
        this.camp     = camp;
        this.overlord = ol;

        stats        = new EntityStats();
        stats.attack = 10000;
        cSlice       = this.gameObject.AddComponent <CombatSlice>();
        //cSlice = new CombatSlice();
        cSlice.init(stats, this, null, null);
        active = true;
    }
Exemplo n.º 31
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        GUILayout.Space(30);
        GUILayout.Label("Functions for use in editor");
        Overlord overlord = (Overlord)target;

        overlord.EditorInit();

        MapSlice mSlice = overlord.environmentCore.mapSlice;

        if (GUILayout.Button("Generate map from file"))
        {
            mSlice.InitMap();
            Debug.LogError("[WARNING - Game Breaker] Don't forget to set center hub as uncapturable!");
        }

        if (GUILayout.Button("Clear Tiles"))
        {
            Transform[] res = mSlice.mapRoot.GetComponentsInChildren <Transform>();
            foreach (Transform t in res)
            {
                if (t != mSlice.mapRoot.transform && t != null)
                {
                    DestroyImmediate(t.gameObject);
                }
            }
        }

        if (GUILayout.Button("Toggle Hidden Tiles"))
        {
            mSlice.LoadTiles();
            for (int x = 0; x < 35; x++)
            {
                for (int y = 0; y < 35; y++)
                {
                    Tile t = mSlice.map.tMap[x, y];
                    if (t.hiddenBody)
                    {
                        if (t.bodyObj.activeInHierarchy)
                        {
                            t.bodyObj.SetActive(false);
                        }
                        else
                        {
                            t.bodyObj.SetActive(true);
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 32
0
    //Initialize
    public void Init(bool active, STDMath math, Overlord over, Generator mp)
    {
        //Set ecternal variables
        stdMath      = math;
        overlord     = over;
        map          = mp;
        activePlayer = active;

        //set empty action lists
        hireActions    = new UnityAction[5];
        controlActions = new UnityAction[5];
        specialActions = new UnityAction[5];
    }
Exemplo n.º 33
0
 // Use this for initialization
 void Start()
 {
     overlord = this;
 }
Exemplo n.º 34
0
 void Awake()
 {
     instance = this;
 }
Exemplo n.º 35
0
 public PrototypeViewModel(Overlord Overlord)
 {
     this.Overlord = Overlord;
 }
Exemplo n.º 36
0
    void Start()
    {
        instance = this;

        AudioListener.volume = 0;

        Notes = new List<AudioClip>() {A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, B0, B1, B2, B3, B4, B5, B6, B7, B8, B9};

        Random = new System.Random();

        CBO = new CelestialBodyOverlord();
        IO = new InputOverlord();
        IO.Init();
        StartCoroutine(IO.Delay());

        Sun = GameObject.Instantiate(SunPrefab) as GameObject;
        Sun.transform.position = new Vector3(0, 0, 0);

        audio.volume = 0f;
        audio.Play();

        //SetupSpace();

        //CBO.AddBody(new Vector2(3, -3), new Vector2(.4f, 1f), PlanetPrefab);
        //CBO.AddBody(new Vector2(-3, -3), new Vector2(-.4f, 1f), PlanetPrefab);
        //CBO.AddBody(new Vector2(-2, 4), new Vector2(-.6f, -1f), PlanetPrefab);
    }
Exemplo n.º 37
0
 // Use this for initialization
 void Start()
 {
     ouch = GameObject.Find("Ouch").GetComponent<TextMesh>();
     controller = GameObject.Find("GameController").GetComponent<Overlord>();
 }
Exemplo n.º 38
0
 // Use this for initialization
 void Start()
 {
     points = GameObject.Find("Points").GetComponent<TextMesh>();
     controller = GameObject.Find("GameController").GetComponent<Overlord>();
     StartCoroutine(ResetPoints());
 }