Exemplo n.º 1
0
        protected Missile(int instanceId, Tower tower, Minion minion)
        {
            this.instanceId = instanceId;
            this.ownerTower = tower;
            this.targetMinion = minion;
			this.position = tower.getWorldMissileCreatePosition();
        }
Exemplo n.º 2
0
		public virtual void createMinion (Assets.Scripts.Engine.Minions.Minion minion)
		{
			this.minion = minion;
			minion.tag = this;
			minionObject = (GameObject)GameObject.Instantiate(childStaticMinionObject);
			minionObject.name = "m_" + minion.instanceId;
			
            healthBar = minionObject.transform.FindChild("HealthBar").gameObject.GetComponent<HealthBarDrawer>();
		    if (healthBar != null)
		    {
		        healthBar.health = (int) minion.stats.health;
		        healthBar.maxHealth = (int) minion.stats.healthTotal;
		    }


		    animations = (Animation[]) minionObject.GetComponentsInChildren<Animation>();
            foreach (Animation animation in animations)
                if(animation["walk"] != null)
			        animation["walk"].speed = minion.stats.baseMovementSpeed * walkAnimationSpeedMultiplier();

			rangeProjector = (Projector)GameObject.Instantiate(childStaticRangeProjector);
			rangeProjector.transform.parent = minionObject.transform;
			rangeProjector.transform.localPosition = new Vector3(0, 0.2f, 0);
			rangeProjector.orthographicSize = 0.2f;
			rangeProjector.enabled = false;

		    soundPlayer = minionObject.AddComponent<AudioSource>();
		    soundPlayer.volume = 2;
            soundPlayer.rolloffMode = AudioRolloffMode.Linear;
		    if (spawnSound == null)
		        spawnSound = Resources.Load<AudioClip>("Sound/minion_spawn");
		    soundPlayer.clip = spawnSound;
            soundPlayer.Play();
		}
Exemplo n.º 3
0
		public CatapultMissile(int instanceId, Tower ownerTower, Minion targetMinion) : base(instanceId,ownerTower, targetMinion)
		{
			//position = ownerTower.getWorldPosition();
			targetPosition = targetMinion.getWorldHeadPosition();
			lastDistanceToTarget = (targetPosition - position).magnitude;
			
			calcSpeedDirection();
		}
Exemplo n.º 4
0
        public virtual void createMinion(Assets.Scripts.Engine.Minions.Minion minion)
        {
            this.minion       = minion;
            minion.tag        = this;
            minionObject      = (GameObject)GameObject.Instantiate(childStaticMinionObject);
            minionObject.name = "m_" + minion.instanceId;

            healthBar = minionObject.transform.FindChild("HealthBar").gameObject.GetComponent <HealthBarDrawer>();
            if (healthBar != null)
            {
                healthBar.health    = (int)minion.stats.health;
                healthBar.maxHealth = (int)minion.stats.healthTotal;
            }


            animations = (Animation[])minionObject.GetComponentsInChildren <Animation>();
            foreach (Animation animation in animations)
            {
                if (animation["walk"] != null)
                {
                    animation["walk"].speed = minion.stats.baseMovementSpeed * walkAnimationSpeedMultiplier();
                }
            }

            rangeProjector = (Projector)GameObject.Instantiate(childStaticRangeProjector);
            rangeProjector.transform.parent        = minionObject.transform;
            rangeProjector.transform.localPosition = new Vector3(0, 0.2f, 0);
            rangeProjector.orthographicSize        = 0.2f;
            rangeProjector.enabled = false;

            soundPlayer             = minionObject.AddComponent <AudioSource>();
            soundPlayer.volume      = 2;
            soundPlayer.rolloffMode = AudioRolloffMode.Linear;
            if (spawnSound == null)
            {
                spawnSound = Resources.Load <AudioClip>("Sound/minion_spawn");
            }
            soundPlayer.clip = spawnSound;
            soundPlayer.Play();
        }
Exemplo n.º 5
0
		public abstract void step(Minion minion);
        public override void createMinion(Minion minion)
        {
            base.createMinion(minion);

            teleportAnimation = minionObject.GetComponentInChildren<Sprite>() as Sprite;            
        }
Exemplo n.º 7
0
 public void biteMinion(Minion minion)
 {
     GameObject.Instantiate(biteEffectObject, minion.getWorldHeadPosition(), Quaternion.identity);
 }
Exemplo n.º 8
0
		public OneToAllMissile(int instanceId, Tower ownerTower, Minion targetMinion) : base(instanceId,ownerTower, targetMinion)
		{
		}
Exemplo n.º 9
0
		public virtual void drawInfoPanelGUI ()
		{
			UIControllerGame controller = UIControllerGame.getInstance();

			Minion minion;
			if (this.minion == null)
				minion = TypeIdGenerator.getMinionInsts (TypeIdGenerator.getMinionId(this.minionType));
			else
				minion = this.minion;
				
			controller.label_MinionCost.text = minion.getCost().ToString();
			controller.label_MinionFireRes.text = "-";
			controller.label_MinionPhysRes.text = "-";
			controller.label_MinionPoisonRes.text = "-";
			controller.label_MinionIncome.text = minion.getIncome().ToString();
			controller.label_MinionReward.text = minion.getKillGold().ToString();
			controller.label_MinionHealth.text = minion.stats.healthTotal.ToString();
			controller.label_MinionMS.text = minion.stats.baseMovementSpeed.ToString();	
			controller.label_MinionTitle.text = minion.getName();
            controller.label_MinionDescription.text = getInfo();
			controller.sprite_MinionIcon.mainTexture = childStaticMinionIcon;

			//remove all upgrade buttons remaining from previous
			var children = new List<GameObject>();
			foreach (Transform child in controller.panel_UpgradeMinionContainer.transform) children.Add(child.gameObject);
			children.ForEach(child => GameObject.Destroy(child));
				
			// eger bu cizim sadece bilgi gostermek icinse veya bu minion sana aitse upgrade'leri ekle
            if (this.minion == null)
            {
			    var i = 0;
			    foreach (MinionNode node in TypeIdGenerator.getMinionNodeInsts(minionType).children) {
                    if (UserMe.unlockedMinions[TypeIdGenerator.getMinionId(node.minionType)])
                    {
                        Minion child = TypeIdGenerator.getMinionInsts(TypeIdGenerator.getMinionId(node.minionType));
                        IMinionGUI childGUI = TypeIdGeneratorGUI.minionGuiInst[TypeIdGenerator.getMinionId(node.minionType)];

                        GameObject button = (GameObject)GameObject.Instantiate(controller.button_UpgradeMinionSample);
                        button.transform.parent = controller.panel_UpgradeMinionContainer.transform;
                        button.transform.localScale = new Vector3(1, 1, 1);
                        button.transform.localPosition = controller.button_UpgradeMinionSample.transform.localPosition + new Vector3(60 * i, 0, 0);


                        button.GetComponentsInChildren<UILabel>(true)[0].text = child.getUpgradeCost().ToString();
                        button.GetComponentsInChildren<Tooltiper>(true)[0].text = childGUI.getUpgradeInfo();
                        childGUI.drawCreateMinionButtonGUI(button);

                        UIButtonMessage msg = button.GetComponentsInChildren<UIButtonMessage>(true)[0];
                        if (child.getCost() > PlayerMe.cash)
                        {
                            button.GetComponentsInChildren<UISlicedSprite>(true)[0].color = Color.red;
                            button.GetComponentsInChildren<UIButtonColor>(true)[0].enabled = false;
                            msg.enabled = false;
                        }
                        else
                            msg.parameter = TypeIdGenerator.getMinionId(minionType).ToString() + " " + TypeIdGenerator.getMinionId(node.minionType).ToString();

                        button.SetActive(true);
                        i++;
                    }
			    }
            }

			controller.panel_MinionInfo.SetActive(true);
		}
Exemplo n.º 10
0
		public override void step(Minion minion)
		{
            minion.stats.movementDirection = -1.0f;
		}
Exemplo n.º 11
0
        public SeedTowerPlantMissile(int instanceId, Vector3 position, Minion targetMinion)
            : base(instanceId, position, targetMinion)
		{
		}
Exemplo n.º 12
0
 public virtual void destroyMinion()
 {
     destroyable = true;
     GameObject.Destroy(minionObject);//GameObject.Destroy(minionObject, animation["death"].length + 0.5f);
     minion = null;
 }
Exemplo n.º 13
0
        public virtual void drawInfoPanelGUI()
        {
            UIControllerGame controller = UIControllerGame.getInstance();

            Minion minion;

            if (this.minion == null)
            {
                minion = TypeIdGenerator.getMinionInsts(TypeIdGenerator.getMinionId(this.minionType));
            }
            else
            {
                minion = this.minion;
            }

            controller.label_MinionCost.text         = minion.getCost().ToString();
            controller.label_MinionFireRes.text      = "-";
            controller.label_MinionPhysRes.text      = "-";
            controller.label_MinionPoisonRes.text    = "-";
            controller.label_MinionIncome.text       = minion.getIncome().ToString();
            controller.label_MinionReward.text       = minion.getKillGold().ToString();
            controller.label_MinionHealth.text       = minion.stats.healthTotal.ToString();
            controller.label_MinionMS.text           = minion.stats.baseMovementSpeed.ToString();
            controller.label_MinionTitle.text        = minion.getName();
            controller.label_MinionDescription.text  = getInfo();
            controller.sprite_MinionIcon.mainTexture = childStaticMinionIcon;

            //remove all upgrade buttons remaining from previous
            var children = new List <GameObject>();

            foreach (Transform child in controller.panel_UpgradeMinionContainer.transform)
            {
                children.Add(child.gameObject);
            }
            children.ForEach(child => GameObject.Destroy(child));

            // eger bu cizim sadece bilgi gostermek icinse veya bu minion sana aitse upgrade'leri ekle
            if (this.minion == null)
            {
                var i = 0;
                foreach (MinionNode node in TypeIdGenerator.getMinionNodeInsts(minionType).children)
                {
                    if (UserMe.unlockedMinions[TypeIdGenerator.getMinionId(node.minionType)])
                    {
                        Minion     child    = TypeIdGenerator.getMinionInsts(TypeIdGenerator.getMinionId(node.minionType));
                        IMinionGUI childGUI = TypeIdGeneratorGUI.minionGuiInst[TypeIdGenerator.getMinionId(node.minionType)];

                        GameObject button = (GameObject)GameObject.Instantiate(controller.button_UpgradeMinionSample);
                        button.transform.parent        = controller.panel_UpgradeMinionContainer.transform;
                        button.transform.localScale    = new Vector3(1, 1, 1);
                        button.transform.localPosition = controller.button_UpgradeMinionSample.transform.localPosition + new Vector3(60 * i, 0, 0);


                        button.GetComponentsInChildren <UILabel>(true)[0].text   = child.getUpgradeCost().ToString();
                        button.GetComponentsInChildren <Tooltiper>(true)[0].text = childGUI.getUpgradeInfo();
                        childGUI.drawCreateMinionButtonGUI(button);

                        UIButtonMessage msg = button.GetComponentsInChildren <UIButtonMessage>(true)[0];
                        if (child.getCost() > PlayerMe.cash)
                        {
                            button.GetComponentsInChildren <UISlicedSprite>(true)[0].color  = Color.red;
                            button.GetComponentsInChildren <UIButtonColor>(true)[0].enabled = false;
                            msg.enabled = false;
                        }
                        else
                        {
                            msg.parameter = TypeIdGenerator.getMinionId(minionType).ToString() + " " + TypeIdGenerator.getMinionId(node.minionType).ToString();
                        }

                        button.SetActive(true);
                        i++;
                    }
                }
            }

            controller.panel_MinionInfo.SetActive(true);
        }
Exemplo n.º 14
0
 public void targetMinion(Minion minion)
 {
     for (int i = 0; i < targetMinions.Length; i++)
     {
         if (targetMinions[i] == null)
         {
             targetMinions[i] = minion;
             return;
         }
     }
     Debug.Log("LaserTowerGUI: bu lazer kulesi yeni bir hedefe odaklanabilmek icin once varolan hedeflerinden birinden vazgecmeli.");
 }
Exemplo n.º 15
0
 public SeedTowerMissile(int instanceId, Tower ownerTower, Minion targetMinion)
     : base(instanceId, ownerTower, targetMinion)
 {
 }
Exemplo n.º 16
0
 public override void createMinion(Minion minion)
 {
     base.createMinion(minion);
     lineDrawer = minionObject.GetComponentInChildren<LineDrawer>() as LineDrawer;
     roboHookMinion = (RoboHookMinion)minion;    // parent tutuyor aslinda minionu, ama ben surekli RoboHookMinon a cast etmek istemiyorum. hazir cast edilmisini elimde tutacagim.
 }
Exemplo n.º 17
0
		public PetrolBombMissile(int instanceId, Tower ownerTower, Minion targetMinion) : base(instanceId,ownerTower, targetMinion)
		{
			targetPosition = targetMinion.getWorldPosition();
		}
Exemplo n.º 18
0
 public void tower_laserTower_target(LaserTower tower, Minion targetMinion)
 {
     LaserTowerGUI gui = tower.tag as LaserTowerGUI;
     gui.targetMinion(targetMinion);
 }
Exemplo n.º 19
0
 protected Missile(int instanceId, Vector3 position, Minion minion)
 {
     this.instanceId = instanceId;
     this.targetMinion = minion;
     this.position = position;
 }
Exemplo n.º 20
0
 public void tower_droseraTower_bite(DroseraTower tower, Minion minion)
 {
     DroseraTowerGUI gui = tower.tag as DroseraTowerGUI;
     gui.biteMinion(minion);
 }
Exemplo n.º 21
0
 public TrypanophobiaMissile(int instanceId, Tower ownerTower, Minion targetMinion)
     : base(instanceId, ownerTower, targetMinion)
 {
 }
Exemplo n.º 22
0
        /// <summary>
        /// Verilen minionu boarda ekler.
        /// </summary>        
        public void AddMinion(Minion minion)
        {			
            toBeAddedMinions.Add(minion);
			//minions.Add(minion.instanceId, minion);
			minion.position.board = this;
        }
Exemplo n.º 23
0
		public virtual void destroyMinion ()
		{
			destroyable = true;
            GameObject.Destroy(minionObject);//GameObject.Destroy(minionObject, animation["death"].length + 0.5f);
			minion = null;
		}
Exemplo n.º 24
0
 /// <summary>
 /// verilen minion'un position.board elemanini 'null'a esitler. Bu minionu iceren liste, iteration sirasinda bu durumu farkedip minionu listeden silecektir.
 /// </summary>
 /// <param name="minion">board'dan cikarilacak minion</param>
 public void RemoveMinion(Minion minion)
 {
     minion.position.board = null;       // burada hashmap uzerinde herhangi bir islem yapmiyoruz. aksi takdirde minionlari gezen foreach iteration'ini bozabiliriz. bu minion daha sonra iteration tarafindan tespit edilip listeden silinecek, sadece board'i null yapmak yeterli.
 }
Exemplo n.º 25
0
 public void tower_blackHoleTower_teleportEnd(Minion minion)
 {
     GameObject.Instantiate(BlackHoleTowerGUI.teleportEndEffectObject, minion.getWorldHeadPosition(), Quaternion.identity);
 }
Exemplo n.º 26
0
		public ElectricityMissile(int instanceId, Tower ownerTower, Minion targetMinion) : base(instanceId,ownerTower, targetMinion)
		{
		}
Exemplo n.º 27
0
        public void AddMinionSpecificPosition(Minion minion, PathPosition position)
        {
            try
            {
                toBeAddedMinions.Add(minion);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace + " : " + e.Message);
            }

            if (minion.position == null)
                minion.position = new MinionPosition();

            minion.position.board = this;
            minion.position.pathPosition = new PathPosition(position.pointIndex, position.ratio);

        }
Exemplo n.º 28
0
 public void minion_quantumSoldier_teleport(Minion minion)
 {
     if (minion.tag != null && minion.tag is Assets.Scripts.GUI.Minions.QuantumSoldierMinionGUI)
     {
         ((Assets.Scripts.GUI.Minions.QuantumSoldierMinionGUI)minion.tag).teleport();
     }
 }
 public void createMinionEffect(Engine.Minions.Minion minion, Engine.Effects.MinionEffects.MinionEffect minionEffect)
 {
     spriteContainer = (GameObject) GameObject.Instantiate(staticSpriteContainer, minion.getWorldHeadPosition(),Quaternion.identity);
     this.minion = minion;
     this.effect = minionEffect;
 }
Exemplo n.º 30
0
		public ContagiousMissile(int instanceId, Tower ownerTower, Minion targetMinion) : base(instanceId,ownerTower, targetMinion)
		{
		}
Exemplo n.º 31
0
		public BallistaMissile(int instanceId, Tower ownerTower, Minion targetMinion) : base(instanceId,ownerTower, targetMinion)
		{
		}
 public override void createMinion(Minion minion)
 {
     base.createMinion(minion);
     findSacks();
 }