示例#1
0
 public Giant(IBehaviourManager behaviourManager, int distance, string name)
 {
     this.lives            = 10;
     this.behaviourManager = behaviourManager;
     this.distance         = distance;
     this.name             = name;
 }
示例#2
0
        /// <summary>
        /// Factory for the creation of entities - Passes
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="col"></param>
        /// <param name="phys"></param>
        /// <param name="IBehave"></param>
        /// <param name="behave"></param>
        /// <returns></returns>
        public T CreateEnt <T>(Texture2D text, Vector2 posn, IBehaviourManager behave) where T : IEntity, new()
        {
            //Create a new object of type T
            T Ent = new T();

            //Call the Initialise Method of Type T
            Ent.Initialize(text, posn, behave);
            //Add the object to a list of entities
            Entities.Add(Ent);
            return(Ent);
        }
示例#3
0
        public static IEnumerable <Type> GetManagedTypes(this IBehaviourManager manager)
        {
            var managerType = manager.GetType();

            Type[] behaviourTypes = null;
            if (!managedTypes.TryGetValue(managerType, out behaviourTypes))
            {
                var types = from i in managerType.GetInterfaces()
                            where i.FullName.StartsWith(typeof(IBehaviourManager <>).FullName)
                            select i.GetGenericArguments().First();

                behaviourTypes            = types.ToArray();
                managedTypes[managerType] = behaviourTypes;
            }

            return(behaviourTypes);
        }
示例#4
0
        void Start()
        {
            var updateManagerObject = new GameObject("UpdateManager");

            _updateManager = updateManagerObject.AddComponent <UpdateManager>();

            var coroutiner = new GameObject("Coroutiner").AddComponent <Coroutiner>();

            _objectCreateManager = new ObjectCreateManager();
            _objectStorage       = new ObjectStorage();

            _dataLoadManager = new DataLoadManager(_objectStorage);

            _poolManager = new PoolManager(_objectStorage, _objectCreateManager);

            _dataLoadManager.ReadConfig();
            _dataLoadManager.LoadPrefabs();
            _dataLoadManager.CreateUpgrades();
            _behaviourManager = new BehaviourManager(_updateManager, _objectStorage);

            _UIManager = new UIManager(_updateManager, _objectStorage, _poolManager, _dataLoadManager, _behaviourManager);
            _UIManager.ShowMainMenu(); //start game here
        }
示例#5
0
 public abstract void Initialize(Texture2D Tex, Vector2 Posn, IBehaviourManager behaviours);
示例#6
0
        public UIManager(IUpdateManager updateManager, IObjectStorage objectStorage, IPoolManager poolManager, IDataLoadManager dataLoadManager, IBehaviourManager behaviourManager)
        {
            _updateManager    = updateManager;
            _objectStorage    = objectStorage;
            _poolManager      = poolManager;
            _dataLoadManager  = dataLoadManager;
            _behaviourManager = behaviourManager;

            _updateManager.AddUpdatable(this);

            _buttons = new Dictionary <string, Button>();

            _mainMenu = GameObject.Find("MainMenu");
            _gameMenu = GameObject.Find("GameMenu");

            _buttons.Add(Constants.playBatton, GameObject.Find(Constants.playBatton).GetComponent <Button>());
            _buttons.Add(Constants.exitButton, GameObject.Find(Constants.exitButton).GetComponent <Button>());

            _buttons.Add(Constants.pauseButton, GameObject.Find(Constants.pauseButton).GetComponent <Button>());

            _buttons.Add(Constants.continueButton, GameObject.Find(Constants.continueButton).GetComponent <Button>());
            _buttons.Add(Constants.restartButton, GameObject.Find(Constants.restartButton).GetComponent <Button>());
            _buttons.Add(Constants.backButton, GameObject.Find(Constants.backButton).GetComponent <Button>());

            _buttons.Add(Constants.firstUpgradeButton, GameObject.Find(Constants.firstUpgradeButton).GetComponent <Button>());
            _buttons.Add(Constants.secondUpgradeButton, GameObject.Find(Constants.secondUpgradeButton).GetComponent <Button>());
            _buttons.Add(Constants.thirdUpgradeButton, GameObject.Find(Constants.thirdUpgradeButton).GetComponent <Button>());

            _buttons.Add(Constants.machineButton, GameObject.Find(Constants.machineButton).GetComponent <Button>());
            _buttons.Add(Constants.weaponApplyButton, GameObject.Find(Constants.weaponApplyButton).GetComponent <Button>());


            _buttons[Constants.playBatton].onClick.AddListener(delegate() { StartLevel(); });
            _buttons[Constants.exitButton].onClick.AddListener(delegate() { QuitApplication(); });

            _buttons[Constants.pauseButton].onClick.AddListener(delegate() { OpenGameMenu(); });

            _buttons[Constants.continueButton].onClick.AddListener(delegate() { ContinueLevel(); });
            _buttons[Constants.restartButton].onClick.AddListener(delegate() { RestartLevel(); });
            _buttons[Constants.backButton].onClick.AddListener(delegate() { OpenMainMenu(); });

            _buttons[Constants.firstUpgradeButton].onClick.AddListener(delegate() { ApplyFirstUpgrade(); });
            _buttons[Constants.secondUpgradeButton].onClick.AddListener(delegate() { ApplySecondUpgrade(); });
            _buttons[Constants.thirdUpgradeButton].onClick.AddListener(delegate() { ApplyThirdUpgrade(); });

            _buttons[Constants.machineButton].onClick.AddListener(delegate() { OpenMachineMenu(); });
            _buttons[Constants.weaponApplyButton].onClick.AddListener(delegate() { WeaponApplyMenu(); });

            _healthBar     = GameObject.Find("Healthbar").GetComponent <Slider>();
            _experiencebar = GameObject.Find("Experiencebar").GetComponent <Slider>();

            _upgradeMenu       = GameObject.Find("UpgradeMenu");
            _firstTitle        = GameObject.Find("FirstTitle").GetComponent <TextMeshProUGUI>();
            _firstDescription  = GameObject.Find("FirstDescription").GetComponent <TextMeshProUGUI>();
            _secondTitle       = GameObject.Find("SecondTitle").GetComponent <TextMeshProUGUI>();
            _secondDescription = GameObject.Find("SecondDescription").GetComponent <TextMeshProUGUI>();
            _thirdTitle        = GameObject.Find("ThirdTitle").GetComponent <TextMeshProUGUI>();
            _thirdDescription  = GameObject.Find("ThirdDescription").GetComponent <TextMeshProUGUI>();

            _coinPanel = GameObject.Find("CoinPanel");
            _coinValue = GameObject.Find("CoinValue").GetComponent <TextMeshProUGUI>();

            _magazinePanel     = GameObject.Find("MagazinePanel");
            _bulletImagePrefab = Resources.Load(Constants.prefabPath + "BulletImage") as GameObject;
            _bulletImages      = new List <GameObject>();

            _machineMenu             = GameObject.Find("MachineMenu");
            _machineDropdown         = GameObject.Find("MachineDropdown").GetComponent <TMP_Dropdown>();
            _machineDropdown.options = new List <TMP_Dropdown.OptionData>
            {
                new TMP_Dropdown.OptionData(_objectStorage.WeaponTemplates[WeaponType.PlayerBlaster.ToString()].Alias),
                new TMP_Dropdown.OptionData(_objectStorage.WeaponTemplates[WeaponType.PlayerShotgun.ToString()].Alias),
            };
            _machineDropdown.onValueChanged.AddListener(delegate { MachineDropdownValueChangedHandler(_machineDropdown); });
            _weaponDescription = GameObject.Find("WeaponDescription").GetComponent <TextMeshProUGUI>();
        }