Пример #1
0
    private void SelectShield(Items.ShieldData shieldData, GameObject player)
    {
        switch (shieldData.ShieldType)
        {
        case ShieldType.AbsorbShield:
            player.AddComponent <AbsorbShield>();
            break;

        case ShieldType.ReflectShield:
            player.AddComponent <ReflectShield>();
            break;

        case ShieldType.HealShield:
            player.AddComponent <HealShield>();
            break;

        case ShieldType.BoostShield:
            player.AddComponent <BoostShield>();
            break;

        default:
            break;
        }
        var shieldComp = player.GetComponent <Shield>();

        shieldComp.MaxEnergy    = shieldData.Energy;
        shieldComp.ShieldPrefab = shieldData.ShieldPrefab;
    }
Пример #2
0
        private static ShieldData GenerateShield()
        {
            ShieldData shield     = new ShieldData();
            ShieldType shieldType = (ShieldType)Random.Range(0, 4);

            shield.ShieldType = shieldType;
            switch (shieldType)
            {
            case ShieldType.AbsorbShield:
                shield.Name         = "ABSORBING SHIELD";
                shield.ShieldPrefab = LoadItemPrefab("Shields/AbsorbShield");
                break;

            case ShieldType.ReflectShield:
                shield.Name         = "REFLECTIVE SHIELD";
                shield.ShieldPrefab = LoadItemPrefab("Shields/ReflectShield");
                break;

            case ShieldType.HealShield:
                shield.Name         = "HEALING SHIELD";
                shield.ShieldPrefab = LoadItemPrefab("Shields/HealShield");
                break;

            case ShieldType.BoostShield:
                shield.Name         = "SPEED SHIELD";
                shield.ShieldPrefab = LoadItemPrefab("Shields/BoostShield");
                break;
            }
            shield.Energy = Random.Range(100, 250);
            return(shield);
        }
Пример #3
0
    public void ChangeEquipedShieldText(Items.ShieldData shieldData)
    {
        if (shieldData == null)
        {
            return;
        }

        maxEneryText.text   = shieldData.Energy.ToString();
        shieldNameText.text = shieldData.Name;
    }
Пример #4
0
        public static ShieldData DefaultShield()
        {
            ShieldData shield = new ShieldData();

            shield.ShieldType   = ShieldType.AbsorbShield;
            shield.Energy       = 100;
            shield.Name         = "ABSORBING SHIELD";
            shield.ShieldPrefab = LoadItemPrefab("Shields/AbsorbShield");
            return(shield);
        }