Esempio n. 1
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);
        }
Esempio n. 2
0
 // Carga el menú y resetea el juego
 public void LoadMainMenu()
 {
     Time.timeScale = 1f;
     lastCheckpoint = Vector2.zero;
     currentShield  = ShieldType.woodenPlank;
     StartCoroutine(MainMenu());
 }
Esempio n. 3
0
        public Shield(ShieldType shieldtype, Base.UControllerType basetype)
        {
            Type       = shieldtype;
            ShieldBase = new Base(basetype);
            Connectors = new List <Connector>();
            TimeEvents = new List <TimeEvent>();

            switch (shieldtype)
            {
            case ShieldType.Central:
                break;

            case ShieldType.Roseta:
                //Definimos un tipo Roseta generico: 2 digitales, 2 analogicos, 3 PWM, 1 dimmer
                AddConnector("Digital0", Enums.ConnectorType.IODigital, new String[] { "A0" });
                AddConnector("Digital1", Enums.ConnectorType.IODigital, new String[] { "A1" });
                AddConnector("Analog0", Enums.ConnectorType.Analog, new String[] { "F0" });
                AddConnector("Analog1", Enums.ConnectorType.Analog, new String[] { "F1" });
                AddConnector("Analog2", Enums.ConnectorType.Analog, new String[] { "F2" });
                AddConnector("PWM", Enums.ConnectorType.IODigital, new String[] { "B4", "B7", "G5" });
                AddConnector("Dimmer0", Enums.ConnectorType.Dimmer, new String[] { "G0" });
                break;

            case ShieldType.Regleta:
                break;

            case ShieldType.Lampara:
                break;

            default:
                throw new Exception();
            }
        }
Esempio n. 4
0
    public float DamageShield(ShieldType shieldType, float damage)
    {
        float remainingDamage = damage;

        if (shieldType == ShieldType.MAGIC && magicShield.GetTotal() > 0)
        {
            remainingDamage = magicShield.DamageShield(remainingDamage);
            if (OnShieldChanged != null)
            {
                OnShieldChanged(shieldType, magicShield.GetTotal());
            }
        }
        else if (shieldType == ShieldType.PHYSICAL && physicalShield.GetTotal() > 0)
        {
            remainingDamage = physicalShield.DamageShield(remainingDamage);
            if (OnShieldChanged != null)
            {
                OnShieldChanged(shieldType, physicalShield.GetTotal());
            }
        }

        if (remainingDamage > 0 && shield.GetTotal() > 0)
        {
            remainingDamage = shield.DamageShield(remainingDamage);
            if (OnShieldChanged != null)
            {
                OnShieldChanged(ShieldType.NORMAL, shield.GetTotal());
            }
        }

        return(remainingDamage);
    }
Esempio n. 5
0
 /// <summary>
 /// Set the component statistics of this ship
 /// </summary>
 /// <param name="shipType">the ShipType of this ship</param>
 /// <param name="armorType">the ArmorType of this ship</param>
 /// <param name="shieldType">the ShieldType of this ship</param>
 public void SetStatistics(ShipType shipType, ArmorType armorType, ShieldType shieldType)
 {
     if (this.HasShield)
     {
         this.cShield.Activate(shieldType);
     }
 }
        ShieldDefinition getShieldDefinition()
        {
            ShieldType type = m_shieldType;

            if (type == ShieldType.LargeBlockSmall)
            {
                return(EnergyShieldsCore.Config.LargeBlockSmallGenerator);
            }
            else if (type == ShieldType.LargeBlockLarge)
            {
                return(EnergyShieldsCore.Config.LargeBlockLargeGenerator);
            }
            else if (type == ShieldType.SmallBlockSmall)
            {
                return(EnergyShieldsCore.Config.SmallBlockSmallGenerator);
            }
            else if (type == ShieldType.SmallBlockLarge)
            {
                return(EnergyShieldsCore.Config.SmallBlockLargeGenerator);
            }
            else
            {
                return(EnergyShieldsCore.Config.LargeBlockSmallGenerator);
            }
        }
Esempio n. 7
0
    // Al recoger un escudo actualiza los valores adecuados.
    public void GetShield(ShieldType sType)
    {
        SceneLoader.instance.SetShield(sType);

        int i = 0;

        //Buscamos el escudo recogido entre el array de escudos conocidos
        while (i < shieldArray.Length && shieldArray[i].shieldType != sType)
        {
            i++;
        }
        //Si no se encontró, no hacemos nada
        if (i == shieldArray.Length)
        {
            return;
        }

        //Actualizamos los PS del escudo, así como sus PS máximos
        shieldHP = shieldMaxHP = shieldArray[i].durability;
        playerController.ShieldBroken(false);

        //Actualizamos la velocidad del jugador según el peso del escudo nuevo
        if (playerController != null)
        {
            playerController.AddWeight(shieldArray[i].weight);
        }

        //Actualizamos el sprite y el icono del escudo
        UIManager.UpdateShieldHolder(shieldArray[i].sprite);
        UIManager.UpdateShieldBar(shieldMaxHP, shieldHP);
        shield.GetComponent <SpriteRenderer>().sprite = shieldArray[i].sprite;
    }
Esempio n. 8
0
        public override void Init(MyObjectBuilder_EntityBase objectBuilder)
        {
            m_objectBuilder     = objectBuilder;
            Entity.NeedsUpdate |= MyEntityUpdateEnum.EACH_FRAME | MyEntityUpdateEnum.BEFORE_NEXT_FRAME;
            NeedsUpdate        |= MyEntityUpdateEnum.EACH_FRAME | MyEntityUpdateEnum.BEFORE_NEXT_FRAME;

            m_shieldType = getShieldType();

            IMyCubeBlock cubeBlock = Entity as IMyCubeBlock;


            cubeBlock.AddUpgradeValue("ShieldPoints", 1f);
            cubeBlock.AddUpgradeValue("ShieldRecharge", 1f);
            cubeBlock.AddUpgradeValue("PowerConsumption", 1f);

            Sandbox.ModAPI.IMyTerminalBlock terminalBlock = Entity as Sandbox.ModAPI.IMyTerminalBlock;

            terminalBlock.AppendingCustomInfo += UpdateBlockInfo;

            //debug
            if (!EnergyShieldsCore.shieldGenerators.ContainsKey(Entity.EntityId))
            {
                EnergyShieldsCore.shieldGenerators.TryAdd(Entity.EntityId, this);
            }
        }
Esempio n. 9
0
    public virtual void Initialize(InvItemData shieldItem)
    {
        if (shieldItem == null)
        {
            //no shield installed
            TotalCapacity = 0;
        }
        else
        {
            Type               = (ShieldType)Enum.Parse(typeof(ShieldType), shieldItem.Item.GetStringAttribute("Shield Type"));
            Tech               = (ShieldTech)Enum.Parse(typeof(ShieldTech), shieldItem.Item.GetStringAttribute("Shield Technology"));
            Class              = (ShieldClass)Enum.Parse(typeof(ShieldClass), shieldItem.Item.GetStringAttribute("Shield Class"));
            TotalCapacity      = shieldItem.Item.GetFloatAttribute("Capacity");
            RechargeRate       = shieldItem.Item.GetFloatAttribute("Recharge Rate");
            RechargeDelay      = shieldItem.Item.GetFloatAttribute("Recharge Delay");
            this.PowerRequired = shieldItem.Item.GetFloatAttribute("Power Required");
        }

        MyRenderer = this.GetComponent <MeshRenderer>();
        Material mat = null;

        //if playership then load separate materials
        //if NPC then use preloaded materials in material manager
        //this way playership material can be faded without affecting NPC's material

        if (ParentShip == GameManager.Inst.PlayerControl.PlayerShip)
        {
            if (Tech == ShieldTech.Gravity)
            {
                mat = GameObject.Instantiate(Resources.Load("ShieldEffect1")) as Material;
            }
            else if (Tech == ShieldTech.Plasma)
            {
                mat = GameObject.Instantiate(Resources.Load("ShieldEffect2")) as Material;
            }
            else
            {
                mat = GameObject.Instantiate(Resources.Load("ShieldEffect3")) as Material;
            }
            mat.SetFloat("_Brightness", 0);
        }
        else
        {
            if (Tech == ShieldTech.Gravity)
            {
                mat = GameManager.Inst.MaterialManager.ShieldMaterial1;
            }
            else if (Tech == ShieldTech.Plasma)
            {
                mat = GameManager.Inst.MaterialManager.ShieldMaterial2;
            }
            else
            {
                mat = GameManager.Inst.MaterialManager.ShieldMaterial3;
            }
        }

        MyRenderer.materials = new Material[] { mat, mat, mat };
    }
Esempio n. 10
0
        public void SetShield(ShieldType shieldType, float secs)
        {
#if !SERVER
            if (shieldDecor != null)
            {
                Scene.RemoveObject(shieldDecor);
                shieldDecor = null;
            }

            if (shieldComponentFront != null)
            {
                Scene.RemoveObject(shieldComponentFront);
                shieldComponentFront = null;
            }
#endif

            if (shieldType == ShieldType.None)
            {
                shieldTime = 0f;
                return;
            }

            shieldTime = secs * Time.FramesPerSecond;

#if !SERVER
            switch (shieldType)
            {
            case ShieldType.Fire:
                shieldDecor = new ShieldDecor(shieldType, false);
                shieldDecor.OnActivated(new ActorActivationDetails {
                    LevelHandler = levelHandler
                });
                shieldDecor.Parent = this;

                shieldComponentFront = new ShieldDecor(shieldType, true);
                shieldComponentFront.OnActivated(new ActorActivationDetails {
                    LevelHandler = levelHandler
                });
                shieldComponentFront.Parent = this;
                break;

            case ShieldType.Water:
                shieldComponentFront = new ShieldDecor(shieldType, true);
                shieldComponentFront.OnActivated(new ActorActivationDetails {
                    LevelHandler = levelHandler
                });
                shieldComponentFront.Parent = this;
                break;

            case ShieldType.Lightning:
                // ToDo
                break;

            case ShieldType.Laser:
                // ToDo
                break;
            }
#endif
        }
Esempio n. 11
0
        public Shield(ShieldType type, int power, int price, TechLevel minTechLevel, int chance) :
            base(EquipmentType.Shield, price, minTechLevel, chance)
        {
            _type  = type;
            _power = power;

            _charge = _power;
        }
Esempio n. 12
0
    private void OnShieldChanged(ShieldType shieldType, float shieldValue)
    {
        shields[(int)shieldType] = shieldValue;

        UpdateHealthTransform(character.StatsManager.Health.GetCurrentValue());
        UpdateShieldTransforms();
        SetHealthBarSeparators();
    }
Esempio n. 13
0
        /// <summary>
        /// Constructs a <see cref="Shield"/> object of the given type
        /// </summary>
        /// <param name="type">The type of <see cref="Shield"/> to construct</param>
        public Shield(ShieldType type) : base(ItemType.Shield)
        {
            ShieldDataEntry data = ShieldDao.GetData()[type];

            ShieldType = type;
            Defense    = data.Defense;
            Value      = data.Value;
        }
Esempio n. 14
0
        internal ShieldInfo(ShieldType type, int level, HullInfo shipHull)
        {
            this.Type  = type;
            this.Level = level;

            this.vars = new Var(AComponentType.LevelKey, level).
                        And(AComponentType.SizeKey, shipHull.Size).Get;
        }
Esempio n. 15
0
        public Shield(ShieldType type, int power, int price, TechLevel minTechLevel, int chance) :
            base(EquipmentType.Shield, price, minTechLevel, chance)
        {
            _type = type;
            _power = power;

            _charge = _power;
        }
Esempio n. 16
0
        public Shield(GraphicsDevice gDevice, ShieldType type)
        {
            graphicsDevice = gDevice;
            FrameSize      = 65;

            START_POSITION_X = gDevice.Viewport.Width;;
            START_POSITION_Y = gDevice.Viewport.Height - FrameSize * 2;
            this.type        = type;
        }
Esempio n. 17
0
	public void setShieldType (ShieldType type) {
		this.type = type;
		setDescription(type.getDescription());
		switch (type) {
			case ShieldType.WOOD: setSprite(wood); break;
			case ShieldType.IRON: setSprite(iron); break;
			case ShieldType.STEEL: setSprite(steel); break;
			default: Debug.Log("Unknown Shield Type"); break;
		}
	}
Esempio n. 18
0
        /// <summary>
        /// 屏蔽某个@到我的微博以及后续由对其转发引起的@提及
        /// </summary>
        /// <param name="id">需要屏蔽的@提到我的微博ID。此ID必须在statuses/mentions列表中。</param>
        /// <param name="follow_up">是否仅屏蔽当前微博。0:仅屏蔽当前@提到我的微博;1:屏蔽当前@提到我的微博,以及后续对其转发而引起的@提到我的微博。默认1。</param>
        /// <returns></returns>
        public static async Task <bool> Shield(long id, ShieldType follow_up = ShieldType.WithFollowUp)
        {
            Dictionary <string, HttpContent> param = new Dictionary <string, HttpContent>()
            {
                { nameof(id), new StringContent(id.ToString()) },
                { nameof(follow_up), new StringContent(follow_up.ToString("D")) },
            };

            return(JsonConvert.DeserializeObject <JObject>(await HttpHelper.PostAsync(Constants.MENTIONS_SHIELD, param)).Value <bool>("result"));
        }
Esempio n. 19
0
    public void RemoveShield(ShieldType shieldType, AbilityBuff sourceAbilityBuff)
    {
        Shield shieldToChange = GetShield(shieldType);

        shieldToChange.RemoveShield(sourceAbilityBuff);
        if (OnShieldChanged != null)
        {
            OnShieldChanged(shieldType, shieldToChange.GetTotal());
        }
    }
Esempio n. 20
0
    public void UpdateShield(ShieldType shieldType, AbilityBuff sourceAbilityBuff, float shieldChangeValue)
    {
        Shield shieldToChange = GetShield(shieldType);

        shieldToChange.UpdateShield(sourceAbilityBuff, shieldChangeValue);
        if (OnShieldChanged != null)
        {
            OnShieldChanged(shieldType, shieldToChange.GetTotal());
        }
    }
Esempio n. 21
0
 internal void InitialiseFromStruct(Shield shield, ShieldType type)
 {
     Name        = shield.Name;
     Width       = type.Width;
     Height      = type.Height;
     Radius      = shield.Radius;
     MaxStrength = type.Strength;
     _strength   = shield.CurrentStrength;
     MaxAngle    = shield.MaxAngle;
 }
Esempio n. 22
0
        public void SetShield(ShieldType shieldType, float secs)
        {
            if (shieldComponent != null)
            {
                ParentScene.RemoveObject(shieldComponent);
                shieldComponent = null;
            }

            if (shieldComponentFront != null)
            {
                ParentScene.RemoveObject(shieldComponentFront);
                shieldComponentFront = null;
            }

            if (shieldType == ShieldType.None)
            {
                shieldTime = 0f;
                return;
            }

            shieldTime = secs * Time.FramesPerSecond;

            switch (shieldType)
            {
            case ShieldType.Fire:
                shieldComponent = new ShieldComponent(shieldType, false);
                shieldComponent.OnAttach(new ActorInstantiationDetails {
                    Api = api
                });
                shieldComponent.Parent = this;

                shieldComponentFront = new ShieldComponent(shieldType, true);
                shieldComponentFront.OnAttach(new ActorInstantiationDetails {
                    Api = api
                });
                shieldComponentFront.Parent = this;
                break;

            case ShieldType.Water:
                shieldComponentFront = new ShieldComponent(shieldType, true);
                shieldComponentFront.OnAttach(new ActorInstantiationDetails {
                    Api = api
                });
                shieldComponentFront.Parent = this;
                break;

            case ShieldType.Lightning:
                // ToDo
                break;

            case ShieldType.Laser:
                // ToDo
                break;
            }
        }
Esempio n. 23
0
        /// <exclude />
        public static FluentTagBuilder GenerateShieldMarkup(string subject, ShieldType? type = null, string status = null, ShieldColor color = ShieldColor.Green, ShieldStyle style = ShieldStyle.Flat, ShieldImage image = ShieldImage.Png)
        {
            string url;
            subject = subject.Split(' ')[0];
            if (type == null)
                url = Substitute("https://img.shields.io/badge/{subject}-{status}-{color}.{image}", subject.Replace("-", ""), status, color, image, style);
            else
                url = Substitute(GithubForkmeMask[(ShieldType)type], subject, status, color, image, style);

            return new FluentTagBuilder().Tag("img", null, new { src = url });
        }
Esempio n. 24
0
    public ShieldData(ItemQuality quality, float level, ShieldType type, int shieldLevel, int rechargeSpeed) : base(quality, level)
    {
        this.type          = type;
        this.shieldLevel   = shieldLevel;
        this.rechargeSpeed = rechargeSpeed;

        name        = type.name();
        description = type.description();
        volume      = type.volume();
        itemType    = ItemType.SHIELD;
    }
Esempio n. 25
0
 private void OnTriggerEnter(Collider _cCollider)
 {
     if (_cCollider.CompareTag("ShieldBox"))
     {
         m_bShieldActivated    = true;
         m_fCurrentShieldValue = m_fMaxShieldValue;
         m_stShieldType        = _cCollider.gameObject.GetComponent <S_Shield>().btShield;
         SetShield(m_stShieldType);
         _cCollider.gameObject.GetComponent <S_Shield>().Death();
     }
 }
Esempio n. 26
0
        public bool HasShield(ShieldType shieldType)
        {
            bool found = false;

            for (int i = 0; i < Shields.Length && !found; i++)
            {
                if (Shields[i] != null && Shields[i].Type == shieldType)
                {
                    found = true;
                }
            }
            return(found);
        }
Esempio n. 27
0
    public static ShieldData createShieldData(ShieldType type)
    {
        ItemQuality quality = randQuality();
        float       level   = randLevel();

        int shieldLevel = Mathf.RoundToInt(type.shieldProtection() * level * qualityMultiplier(quality));
//		int rechargeSpeed = Mathf.RoundToInt(type.rechargeSpeed() * level * qualityMultiplier(quality));

        ShieldData data = new ShieldData(quality, level, type, shieldLevel, type.rechargeSpeed());

        data.initCommons(calculateCost(data), calculateEnergy(data));

        return(data);
    }
Esempio n. 28
0
    public static string name(this ShieldType type)
    {
        switch (type)
        {
        case ShieldType.BLOCK: return("Блочный щит");

        case ShieldType.QUADRATIC: return("Квадратичный щит");

        case ShieldType.CELL: return("Ячеестый щит");

        case ShieldType.PHASE: return("Фазовый щит");

        default: return("Неизвестный тип щита");
        }
    }
Esempio n. 29
0
    public void Activate(ShieldType type)
    {
        this.type = type;

        if (this.type == ShieldTypes.None)
        {
            this.Disable();
        }
        else
        {
            this.shieldHealthFloat = this.type.Health;
            this.regenAmount       = this.type.Regen;
            this.state             = ShieldState.ACTIVE;
        }
    }
Esempio n. 30
0
    public static int rechargeSpeed(this ShieldType type)
    {
        switch (type)
        {
        case ShieldType.BLOCK: return(1);

        case ShieldType.QUADRATIC: return(2);

        case ShieldType.CELL: return(3);

        case ShieldType.PHASE: return(4);

        default: return(0);
        }
    }
Esempio n. 31
0
    public static float volume(this ShieldType type)
    {
        switch (type)
        {
        case ShieldType.BLOCK: return(1);

        case ShieldType.QUADRATIC: return(1);

        case ShieldType.CELL: return(1);

        case ShieldType.PHASE: return(1);

        default: return(0);
        }
    }
Esempio n. 32
0
    public static int cost(this ShieldType type)
    {
        switch (type)
        {
        case ShieldType.BLOCK: return(100);

        case ShieldType.QUADRATIC: return(200);

        case ShieldType.CELL: return(300);

        case ShieldType.PHASE: return(400);

        default: return(0);
        }
    }
Esempio n. 33
0
    public static int energyNeeded(this ShieldType type)
    {
        switch (type)
        {
        case ShieldType.BLOCK: return(10);

        case ShieldType.QUADRATIC: return(20);

        case ShieldType.CELL: return(30);

        case ShieldType.PHASE: return(40);

        default: return(0);
        }
    }
Esempio n. 34
0
	public void init (ShieldType shieldType, int armor) {
		base.init();
		this.armor = armor;
		setShieldType(shieldType);

		protectionFire = buffSprites.Find("ProtectionFire");
		protectionWater = buffSprites.Find("ProtectionWater");
		protectionAir = buffSprites.Find("ProtectionAir");
		protectionEarth = buffSprites.Find("ProtectionEarth");
		protectionLight = buffSprites.Find("ProtectionLight");
		protectionDark = buffSprites.Find("ProtectionDark");

		protectionFire.gameObject.SetActive(false);
		protectionWater.gameObject.SetActive(false);
		protectionAir.gameObject.SetActive(false);
		protectionEarth.gameObject.SetActive(false);
		protectionLight.gameObject.SetActive(false);
		protectionDark.gameObject.SetActive(false);
	}
        /// <summary>
        /// Factory method for spawning a shield
        /// </summary>
        /// <param name="shieldType">The type of shield to create</param>
        /// <param name="position">Position of the shield in the game world</param>
        /// <param name="PlayerShip">The Player</param>
        /// <returns>The game object id of the projectile</returns>
        public Shield CreateShield(ShieldType shieldType, Vector2 position,
            PlayerShip PlayerShip)
        {
            Shield shield;
            uint id = NextID();

            switch (shieldType)
            {
                case ShieldType.EightBallShield:
                    shield = new EightBallShield(id, content, position, PlayerShip);
                    break;
                default:
                    throw new NotImplementedException("EightBallShield failed.");
            }

            shield.ObjectType = ObjectType.Shield;
            QueueGameObjectForCreation(shield);
            return shield;
        }
Esempio n. 36
0
        public Shield(ShieldType shieldtype, Base.UControllerType basetype)
        {
            Type = shieldtype;
            ShieldBase = new Base(basetype);
            Connectors = new List<Connector>();
            TimeEvents = new List<TimeEvent>();

            switch (shieldtype)
            {
                case ShieldType.Central:
                    break;
                case ShieldType.Roseta:
                    //Definimos un tipo Roseta generico: 2 digitales, 2 analogicos, 3 PWM, 1 dimmer
                    AddConnector("Digital0", Enums.ConnectorType.IODigital, new String[] { "A0" });
                    AddConnector("Digital1", Enums.ConnectorType.IODigital, new String[] { "A1" });
                    AddConnector("Analog0", Enums.ConnectorType.Analog, new String[] { "F0" });
                    AddConnector("Analog1", Enums.ConnectorType.Analog, new String[] { "F1" });
                    AddConnector("Analog2", Enums.ConnectorType.Analog, new String[] { "F2" });
                    AddConnector("PWM", Enums.ConnectorType.IODigital, new String[] { "B4", "B7", "G5" });
                    AddConnector("Dimmer0", Enums.ConnectorType.Dimmer, new String[] { "G0" });
                    break;
                case ShieldType.Regleta:
                    break;
                case ShieldType.Lampara:
                    break;
                default:
                    throw new Exception();
            }
        }
Esempio n. 37
0
 public bool HasShield(ShieldType shieldType)
 {
     bool found = false;
     for (int i = 0; i < Shields.Length && !found; i++)
     {
         if (Shields[i] != null && Shields[i].Type == shieldType)
             found = true;
     }
     return found;
 }
Esempio n. 38
0
 public Shield(Hashtable hash) : base(hash)
 {
     _type = (ShieldType)GetValueFromHash(hash, "_type");
     _power = (int)GetValueFromHash(hash, "_power");
     _charge = (int)GetValueFromHash(hash, "_charge");
 }
Esempio n. 39
0
	void Awake()
	{

		Debug.Log ("started " + this.name);
		if (randomise)
		{
			// Debug.Log("Randomising.");
			System.Random random = new System.Random();

			int randomType = random.Next(1, 300);

			// Debug.Log(randomType);

			if (randomType < 125)
			{
				shieldType = ShieldType.Short;
			}
			else if (randomType > 175)
			{
				shieldType = ShieldType.Tall;
			}
			else
			{
				shieldType = ShieldType.None;
			}

			int randomPosition = 0;

			if (shieldType == ShieldType.Short)
			{
				randomPosition = random.Next(1, 300);
			}
			else if (shieldType == ShieldType.Tall)
			{
				randomPosition = random.Next(1, 200);
			}

			// Debug.Log(randomPosition);

			if (randomPosition < 100)
			{
				shieldPosition = ShieldPosition.Bottom;
			}
			else if (randomPosition < 200)
			{
				shieldPosition = ShieldPosition.Middle;
			}
			else
			{
				shieldPosition = ShieldPosition.Top;
			}

			// Debug.Log("Position:");
			// Debug.Log(shieldPosition.ToString());
			// Debug.Log("Type:");
			// Debug.Log(shieldType.ToString());

		}

		switch (shieldType)
		{
			case ShieldType.None:
				shielded = false;
				break;
			case ShieldType.Short:
				shieldObject = shortShield;
				break;
			case ShieldType.Tall:
				shieldObject = tallShield;
				break;
		}

		if (shielded) {
			GameObject shield = (GameObject) Instantiate (shieldObject, transform.position, transform.rotation);
			shield.transform.parent = transform;
			shield.transform.position = transform.position + new Vector3 (-1.5f, (float)shieldPosition, 0.0f);
			shield.transform.localScale = new Vector3(3.0f, 3.0f, 0.0f);
		}

	}