void OnUnitDestroyed(Unit unit)
 {
     if (unit.IsTower() && towerDestroyedSound != null)
     {
         _PlaySound(towerDestroyedSound);
     }
 }
Exemple #2
0
        //protected float DrawTowerVisualEffect(float startX, float startY, UnitTower tower){

        protected float DrawUnitAnimation(float startX, float startY, Unit item)
        {
            string textF = "Animation Setting ";          //+(!foldVisual ? "(show)" : "(hide)");

            foldAnimation = EditorGUI.Foldout(new Rect(startX, startY += spaceY, spaceX, height), foldAnimation, textF, TDE.foldoutS);
            if (!foldAnimation)
            {
                return(startY);
            }

            startX += 12;

            int objIdx = GetIndexFromHierarchy(item.animatorT, objHierarchyList);

            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), "Animator Object:", "The transform object which contain the Animator component");
            objIdx         = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, height), objIdx, objHierarchylabel);
            item.animatorT = objHierarchyList[objIdx];

            startY += 10;

            TDE.Label(startX, startY += spaceY, width, height, "Clip Idle:", "The animation clip to play when the unit is idle");
            item.clipIdle             = (AnimationClip)EditorGUI.ObjectField(new Rect(startX + spaceX, startY, width, height), item.clipIdle, typeof(AnimationClip), true);

            TDE.Label(startX, startY += spaceY, width, height, "Clip Hit:", "The animation clip to play when the unit is hit by an attack");
            item.clipHit              = (AnimationClip)EditorGUI.ObjectField(new Rect(startX + spaceX, startY, width, height), item.clipHit, typeof(AnimationClip), true);

            TDE.Label(startX, startY += spaceY, width, height, "Clip Idle:", "The animation clip to play when the unit is destroyed");
            item.clipDestroyed        = (AnimationClip)EditorGUI.ObjectField(new Rect(startX + spaceX, startY, width, height), item.clipDestroyed, typeof(AnimationClip), true);

            TDE.Label(startX, startY += spaceY, width, height, "Clip Attack:", "The animation clip to play when the unit attacks");
            item.clipAttack           = (AnimationClip)EditorGUI.ObjectField(new Rect(startX + spaceX, startY, width, height), item.clipAttack, typeof(AnimationClip), true);

            TDE.Label(startX, startY += spaceY, width, height, " - delay:", "Unit's active target field-of-view in angle");
            item.animationAttackDelay = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), item.animationAttackDelay);

            startY += 10;

            if (item.IsCreep())
            {
                TDE.Label(startX, startY += spaceY, width, height, "Clip Move:", "The animation clip to play when the unit is moving");
                item.clipMove             = (AnimationClip)EditorGUI.ObjectField(new Rect(startX + spaceX, startY, width, height), item.clipMove, typeof(AnimationClip), true);

                TDE.Label(startX, startY += spaceY, width, height, "Clip Spawn:", "The animation clip to play when the unit is spawned");
                item.clipSpawn            = (AnimationClip)EditorGUI.ObjectField(new Rect(startX + spaceX, startY, width, height), item.clipSpawn, typeof(AnimationClip), true);

                TDE.Label(startX, startY += spaceY, width, height, "Clip Destination:", "The animation clip to play when the unit reaches destination");
                item.clipDestination      = (AnimationClip)EditorGUI.ObjectField(new Rect(startX + spaceX, startY, width, height), item.clipDestination, typeof(AnimationClip), true);
            }
            if (item.IsTower())
            {
                TDE.Label(startX, startY += spaceY, width, height, "Clip Construct:", "The animation clip to play when the unit is constructing");
                item.clipConstruct        = (AnimationClip)EditorGUI.ObjectField(new Rect(startX + spaceX, startY, width, height), item.clipConstruct, typeof(AnimationClip), true);

                TDE.Label(startX, startY += spaceY, width, height, "Clip Deconstruct:", "The animation clip to play when the unit is deconstructing");
                item.clipDeconstruct      = (AnimationClip)EditorGUI.ObjectField(new Rect(startX + spaceX, startY, width, height), item.clipDeconstruct, typeof(AnimationClip), true);
            }

            return(startY);
        }
Exemple #3
0
        public void Show(Unit unit)
        {
            activeUnit = unit;

            refreshEveryFrame = activeUnit.IsTower() && activeUnit.GetTower().isPreview;

            thisT.position = unit.GetPos();
            CreatePoints(unit);
            thisObj.SetActive(true);
        }
Exemple #4
0
        void OnUnitDestroyed(Unit unit)
        {
            if (!unit.IsTower())
            {
                return;
            }

            if (selectedTower == unit.GetUnitTower())
            {
                ClearSelectedTower();
            }
        }
 void OnUnitDestroyed(Unit unit)
 {
     if (currentTower == null)
     {
         return;
     }
     if (!unit.IsTower() || unit.GetUnitTower() != currentTower)
     {
         return;
     }
     Hide();
 }
Exemple #6
0
 public void SetType(int id, Unit unit)
 {
     ID = id;  srcPrefabID = unit.prefabID;
     if (unit.IsTower())
     {
         srcType = _SrcType.Tower;
     }
     if (unit.IsCreep())
     {
         srcType = _SrcType.Creep;
     }
 }
Exemple #7
0
 public static void OnUnitDestroyed(Unit unit)
 {
     if (unit.IsCreep())
     {
         if (onCreepDestroyedE != null)
         {
             onCreepDestroyedE(unit.unitC);
         }
     }
     else if (!unit.IsTower())
     {
         if (onTowerDestroyedE != null)
         {
             onTowerDestroyedE(unit.unitT);
         }
     }
 }
Exemple #8
0
 void OnUnitDestroyed(Unit unit)
 {
     if (unit.IsCreep())
     {
         if (unit.GetUnitCreep().lifeValue > 0)
         {
             GainLife(unit.GetUnitCreep().lifeValue);
         }
     }
     else if (unit.IsTower())
     {
         if (unit.GetUnitTower() == selectedTower)
         {
             _ClearSelectedTower();
         }
     }
 }
        public void _SelectUnit(Unit unit)
        {
            selectedUnit = unit;

            if (selectedUnit.IsTower())
            {
                //selectedUnit.GetTower().IsTurret()
                //selectedUnit.GetTower().IsAOE()
                //selectedUnit.GetTower().IsMine()
                //selectedUnit.GetTower().IsSupport()
                //selectedUnit.GetTower().IsResource()
                //selectedUnit.GetTower().IsBlock()

                if (selectedUnit.GetTower().IsTurret() || selectedUnit.GetTower().IsAOE() || selectedUnit.GetTower().IsSupport())
                {
                    rIndicator.Show(selectedUnit);
                }
            }
        }
 void OnUnitDestroyed(Unit unit)
 {
     if(unit.IsCreep()){
         if(unit.GetUnitCreep().lifeValue>0) GainLife(unit.GetUnitCreep().lifeValue);
     }
     else if(unit.IsTower()){
         if(unit.GetUnitTower()==selectedTower) _ClearSelectedTower();
     }
 }
Exemple #11
0
 public static void OnUnitDestroyed(Unit unit)
 {
     if (unit.IsCreep())
     {
         if (onCreepDestroyedE != null) onCreepDestroyedE(unit.GetUnitCreep());
     }
     else if (!unit.IsTower())
     {
         if (onTowerDestroyedE != null) onTowerDestroyedE(unit.GetUnitTower());
     }
 }
Exemple #12
0
 void OnUnitDestroyed(Unit unit)
 {
     if(currentTower==null) return;
     if(!unit.IsTower() || unit.GetUnitTower()!=currentTower) return;
     Hide();
 }
		void OnUnitDestroyed(Unit unit){
			if(unit.IsTower() && towerDestroyedSound!=null) _PlaySound(towerDestroyedSound); 
		}
Exemple #14
0
		void OnUnitDestroyed(Unit unit){
			if(!unit.IsTower()) return;
			
			if(selectedTower==unit.GetUnitTower()) ClearSelectedTower();
		}
Exemple #15
0
 void OnUnitDestroyed(Unit unit)
 {
     if(unit.IsCreep()){
         GainScore(unit.GetUnitCreep().scoreValue);
     }
     else if(unit.IsTower()){
         if(unit.GetUnitTower()==selectedTower) _ClearSelectedTower();
     }
 }