Exemplo n.º 1
0
    public void Initialize(int time)
    {
        SpriteRender        = GetComponent <SpriteRenderer>();
        SpriteRender.sprite = GetComponent <SpriteRenderer>().sprite = CustomResources.Load <Sprite>("Status/RootingStatus");

        Time = time;
    }
Exemplo n.º 2
0
        private void Awake()
        {
            _gameScenarioBase = FindObjectOfType <GameScenarioBase>();
            _gameProgress     = FindObjectOfType <GameProgress>();

            _nextSceneNumber = SceneManager.GetActiveScene().buildIndex + _nextLoadSceneNumber;
            if (_gameScenarioBase == null)
            {
                var scenario = CustomResources.Load <GameScenarioBase>
                                   (AssetsPathGameObject.GameObjects[GameObjectType.GameScenarioExecutor]);

                _gameScenarioBase = Instantiate(scenario);
                if (_gameScenarioBase == null)
                {
                    CustomDebug.LogError("GameScenarioExecutor has no scenario", this);
                    return;
                }
            }
            _gameScenarioBase.Inject(_gameProgress);

            Planner.Chain()
            .AddFunc(_gameScenarioBase.ExecuteScenario)
            .AddAction(LoadNextScene)
            ;
        }
 public void InitGame()//запуск игры
 {
     UI.GetSetting();
     Enemyes              = new List <Enemy>();
     characterData        = CustomResources.Load <CharacterData>(StringManager.CharacterDataPath);
     Character            = new Character(characterData);
     playerController     = new PlayerController();
     cameraController     = new CameraController();
     enemySpawnController = new EnemySpawnController();
     enemyController      = new EnemyController();
     MainCamera           = Camera.main.transform; // камера
     Player = GameObject.FindGameObjectWithTag(StringManager.TagPlayer).transform;
     LevelGame.SetActive(true);
     controllers    = new IOnUpdate[5];//можно List<>
     controllers[0] = playerController;
     controllers[1] = cameraController;
     controllers[2] = enemySpawnController;
     controllers[3] = enemyController;
     controllers[4] = timeRemainingController;
     enemySpawnController.OnStart();
     playerController.OnStart();
     cameraController.OnStart();
     UI.GameUi.SetActive(true);
     UI.Menu.SetActive(false);
 }
Exemplo n.º 4
0
    public void DefineEquipment(Equipment equipment)
    {
        Equipment          = equipment;
        AttributeText.text = equipment.AttributePoint.ToString();
        NameText.text      = equipment.Name.ToString();
        ElementImage.GetComponent <Image>().sprite = CustomResources.Load <Sprite>("Elements/" + equipment.Element);
        EquipImage.GetComponent <Image>().sprite   = CustomResources.Load <Sprite>("Equipments/" + equipment.Name);
        UseBuyButton.interactable = Equipment.Enabled;

        if (!Equipment.Buyed)
        {
            UseBuyButtonCaption.text = "$ " + equipment.Price.ToString();
            ButtonType = EquipmentButtonType.Buy;
        }
        else if (!Equipment.Equiped)
        {
            UseBuyButtonCaption.text = "Equip";
            ButtonType = EquipmentButtonType.Equip;
        }
        else
        {
            UseBuyButtonCaption.text = "Using";
            ButtonType = EquipmentButtonType.None;
        }
    }
Exemplo n.º 5
0
    public void Initialize(int damage, int time)
    {
        SpriteRender        = GetComponent <SpriteRenderer>();
        SpriteRender.sprite = CustomResources.Load <Sprite>("Status/BurnStatus");

        Damage = damage;
        Time   = time;
    }
Exemplo n.º 6
0
        public void Execute()
        {
            var prefab = Instantiate(CustomResources.Load <GameObject>("Spells/SpellPrefab"));
            var spell  = prefab.AddComponent <AttackSpell>();

            spell.Initialize(Force, Origin, Target, Critical, null, Sprite);
            spell.Execute();
        }
Exemplo n.º 7
0
    public void Initialize(PowerUpType powerUpType, int quantity, OnSelectPowerUpEvent onSelectPowerUp)
    {
        Quantity         = quantity;
        PowerUpType      = powerUpType;
        OnSelectPowerUp += onSelectPowerUp;

        GetComponent <SpriteRenderer>().sprite = CustomResources.Load <Sprite>("PowerUps/PowerUp" + powerUpType);
    }
Exemplo n.º 8
0
 public RestartMenuBehaviour GetRestartMenu()
 {
     if (_restartMenu == null)
     {
         var resources = CustomResources.Load <RestartMenuBehaviour>(AssetsPathScreen.Screens[ScreenType.MainMenu].Screen);
         _restartMenu = Object.Instantiate(resources, _canvas.transform.position, Quaternion.identity, _canvas.transform);
     }
     return(_restartMenu);
 }
Exemplo n.º 9
0
    private void Awake()
    {
        var effect = CustomResources.Load <GameObject>
                         (AssetsPathGameObject.GameObjects[GameObjectType.ProgressBarEffect]);

        _effectPrefab        = Instantiate(effect);
        _images              = GetComponentsInChildren <Image>();
        transform.localScale = Vector3.zero;
    }
Exemplo n.º 10
0
        public void Initialization()
        {
            if (_cardShuffl == null)
            {
                var cardShufflingController = CustomResources.Load <CardShufflingController>
                                                  (AssetsPathGameObject.GameObjects[GameObjectType.CardShufflingController]);

                _cardShuffl = Instantiate(cardShufflingController);
            }
        }
Exemplo n.º 11
0
    public void Initialization()
    {
        if (HpPrefab == null)
        {
            var manager = CustomResources.Load <GameObject>
                              (AssetsPathGameObject.GameObjects[GameObjectType.HPprefab]);

            HpPrefab = Instantiate(manager);
        }
    }
Exemplo n.º 12
0
        public Card CreateCard(Vector3 cardPosition, Quaternion cardRotation)
        {
            var cardBehaviour = CustomResources.Load <CardBehaviour>
                                    (AssetsPathGameObject.GameObjects[GameObjectType.Card]);
            var gameObject = Object.Instantiate(cardBehaviour, cardPosition, cardRotation).gameObject;

            var result = new Card(gameObject);

            return(result);
        }
Exemplo n.º 13
0
        private void Awake()
        {
            _difficultyData = Data.Instance.DifficultyData;
            _canvas         = GameObject.FindGameObjectWithTag("MainCanvas").GetComponent <Canvas>();
            _gameMenu       = _canvas.GetComponentInChildren <GameMenuBehaviour>(); //GameObject.FindGameObjectWithTag("MainCanvas").
            _hpManager      = _canvas.GetComponentInChildren <HPManagerBehavior>();
            var progressBarBehaviour = CustomResources.Load <ProgressBar>
                                           (AssetsPathGameObject.GameObjects[GameObjectType.ProgressBar]);

            _progressBar = Instantiate(progressBarBehaviour, _gameMenu.transform);
        }
Exemplo n.º 14
0
 public void SetElement(EnumElement?element)
 {
     Element = element;
     if (element == null)
     {
         GetComponent <SpriteRenderer>().sprite = CustomResources.Load <Sprite>("ComboStones/ComboStoneNone");
     }
     else
     {
         GetComponent <SpriteRenderer>().sprite = CustomResources.Load <Sprite>("ComboStones/ComboStone" + element);
     }
 }
Exemplo n.º 15
0
    private void initializePowerUps()
    {
        var powerUpButtons = new PowerUpButton[4];

        powerUpButtons[0] = Instantiate(CustomResources.Load <GameObject>("PowerUps/PowerUpButton")).GetComponent <PowerUpButton>();
        powerUpButtons[0].Initialize(PowerUpType.Fire, 1, onSelectPowerUp);

        powerUpButtons[1] = Instantiate(CustomResources.Load <GameObject>("PowerUps/PowerUpButton")).GetComponent <PowerUpButton>();
        powerUpButtons[1].Initialize(PowerUpType.Water, 1, onSelectPowerUp);

        powerUpButtons[2] = Instantiate(CustomResources.Load <GameObject>("PowerUps/PowerUpButton")).GetComponent <PowerUpButton>();
        powerUpButtons[2].Initialize(PowerUpType.Earth, 1, onSelectPowerUp);

        powerUpButtons[3] = Instantiate(CustomResources.Load <GameObject>("PowerUps/PowerUpButton")).GetComponent <PowerUpButton>();
        powerUpButtons[3].Initialize(PowerUpType.Air, 1, onSelectPowerUp);

        PowerUpBar.Initialize(powerUpButtons);
    }
Exemplo n.º 16
0
    public static ISpell Create(EnumElement element, EnumElement?elementLastRuna, List <Runa> selectedRunas, Character origin, Character target, AttributePoints attributes)
    {
        EnumElement element1 = element;
        EnumElement?element2 = elementLastRuna;

        var prefabSpell = CreateSpellPrefab();

        var force = CalculateSpellForce(selectedRunas, attributes);

        switch (element1)
        {
        case EnumElement.Air:
            switch (element2)
            {
            case EnumElement.Air:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/AirSpell"), force, origin, target, true));

            case EnumElement.Earth:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/AirSpell"), force, origin, target, false));

            case EnumElement.Fire:
                return(CreateBurnSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/BurnSpell"), force, attributes, origin, target));

            case EnumElement.Water:
                return(CreateFreezeTimeSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/FreezeSpell"), attributes));

            case EnumElement.Light:
                return(CreateTimeSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/AddTimeSpell"), attributes));

            case null:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/AirSpell"), force, origin, target, false));

            default:
                return(null);
            }

        case EnumElement.Earth:
            switch (element2)
            {
            case EnumElement.Air:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/EarthSpell"), force, origin, target, false));

            case EnumElement.Earth:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/EarthSpell"), force, origin, target, true));

            case EnumElement.Fire:
                return(CreateLavaSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/LavaSpell"), force, attributes, origin, target));

            case EnumElement.Water:
                return(CreateRootingSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/RootingSpell"), force, attributes, origin, target));

            case EnumElement.Light:
                return(CreateProtectionSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/ProtectionSpell"), force, attributes, origin, target));

            case null:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/EarthSpell"), force, origin, target, false));

            default:
                return(null);
            }

        case EnumElement.Fire:
            switch (element2)
            {
            case EnumElement.Air:
                return(CreateBurnSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/BurnSpell"), force, attributes, origin, target));

            case EnumElement.Earth:
                return(CreateLavaSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/LavaSpell"), force, attributes, origin, target));

            case EnumElement.Fire:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/FireSpell"), force, origin, target, true));

            case EnumElement.Water:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/FireSpell"), force, origin, target, false));

            case EnumElement.Light:
                return(CreateClearStatusSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/ClearStatusSpell"), origin));

            case null:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/FireSpell"), force, origin, target, false));

            default:
                return(null);
            }

        case EnumElement.Water:
            switch (element2)
            {
            case EnumElement.Air:
                return(CreateFreezeTimeSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/FreezeSpell"), attributes));

            case EnumElement.Earth:
                return(CreateRootingSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/RootingSpell"), force, attributes, origin, target));

            case EnumElement.Fire:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/WaterSpell"), force, origin, target, false));

            case EnumElement.Water:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/WaterSpell"), force, origin, target, true));

            case EnumElement.Light:
                return(CreateHealthSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/CureSpell"), force, attributes, origin));

            case null:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/WaterSpell"), force, origin, target, false));

            default:
                return(null);
            }

        case EnumElement.Light:
            switch (element2)
            {
            case EnumElement.Air:
                return(CreateTimeSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/AddTimeSpell"), attributes));

            case EnumElement.Earth:
                return(CreateProtectionSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/ProtectionSpell"), force, attributes, origin, target));

            case EnumElement.Fire:
                return(CreateClearStatusSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/ClearStatusSpell"), origin));

            case EnumElement.Water:
                return(CreateHealthSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/CureSpell"), force, attributes, origin));

            case EnumElement.Light:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/LightSpell"), force, origin, target, false));

            case null:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/LightSpell"), force, origin, target, false));

            default:
                return(null);
            }

        default:
            return(null);
        }
    }
Exemplo n.º 17
0
 public void Start()
 {
     CanvasFade.StartFadeOut(null);
     SoundManager.instance.PlayMusic(CustomResources.Load <AudioClip>("Sounds/Music/ThemeSong"));
     PlayerPrefs.DeleteAll();
 }
Exemplo n.º 18
0
 private static T Load <T>(string resourcesPath) where T : Object =>
 CustomResources.Load <T>(Path.ChangeExtension(resourcesPath, null));
Exemplo n.º 19
0
        public ScreenFactory()
        {
            var resources = CustomResources.Load <Canvas>(AssetsPathGameObject.GameObjects[GameObjectType.Canvas]);

            _canvas = Object.Instantiate(resources, Vector3.one, Quaternion.identity);
        }
Exemplo n.º 20
0
 private static GameObject CreateStatusPrefab()
 {
     return(Instantiate(CustomResources.Load <GameObject>("Status/StatusPrefab")));
 }