Ejemplo n.º 1
0
    public void CheckBlackCrrrpList()
    {
        int index = 0;

        if (m_BlackCreep.Count > 0)
        {
            for (int a = 0; a < m_BlackCreep.Count; a++)
            {
                m_UnitCreep = m_BlackCreep [a].gameObject.GetComponent <UnitCreep> ();
                if (m_UnitCreep != null && m_UnitCreep.attackTarget != null)
                {
                    if (m_BlackCreep [a].transform == m_UnitCreep.attackTarget.transform)
                    {
                        index = 1;
                    }
                    if (index != 1)
                    {
                        m_BlackCreep.Remove(m_UnitCreep.transform);
                    }

                    index = 0;
                }
                if (m_UnitCreep.hp <= 0 || m_UnitCreep.path == null)
                {
                    m_BlackCreep.Remove(m_UnitCreep.transform);
                }
            }
        }
    }
Ejemplo n.º 2
0
 //void OnUnitDestroyed(Unit unit){ if(newWaveSound!=null) _PlaySound(newWaveSound); }
 void OnCreepDestination(UnitCreep creep)
 {
     if (newWaveSound != null)
     {
         _PlaySound(newWaveSound);
     }
 }
Ejemplo n.º 3
0
    //actual spawning routine, responsible for spawning one type of creep only
    IEnumerator SpawnSubwave(SubWave subWave, Wave parentWave, int waveID)
    {
        yield return(new WaitForSeconds(subWave.delay));

        int spawnCount = 0;

        while (spawnCount < subWave.count)
        {
            Vector3    pos;
            Quaternion rot;

            PathTD tempPath;
            if (subWave.path == null)
            {
                tempPath = defaultPath;
            }
            else
            {
                tempPath = subWave.path;
            }

            pos = tempPath.waypoints[0].position;
            rot = tempPath.waypoints[0].rotation;

            GameObject obj = ObjectPoolManager.Spawn(subWave.unit, pos, rot);
            //Unit unit=obj.GetComponent<Unit>();
            UnitCreep unit = obj.GetComponent <UnitCreep>();
            if (subWave.overrideHP > 0)
            {
                unit.SetFullHP(subWave.overrideHP);
            }
            if (subWave.overrideMoveSpd > 0)
            {
                unit.SetMoveSpeed(subWave.overrideMoveSpd);
            }

            List <Vector3> waypoints = new List <Vector3>();
            foreach (Transform pointT in tempPath.waypoints)
            {
                waypoints.Add(pointT.position);
            }
            unit.Init(waypoints, totalSpawnCount, waveID);
            //~ unit.Init(tempPath, totalSpawnCount, waveID);

            totalSpawnCount += 1;

            parentWave.activeUnitCount += 1;

            spawnCount += 1;
            if (spawnCount == subWave.count)
            {
                break;
            }

            yield return(new WaitForSeconds(subWave.interval));
        }

        subWave.spawned = true;
    }
Ejemplo n.º 4
0
    void SwapCreep(int ID)
    {
        UnitCreep creep = creepList[currentSwapID];

        creepList[currentSwapID] = creepList[ID];
        creepList[ID]            = creep;

        currentSwapID = -1;
    }
Ejemplo n.º 5
0
    public static int GetUnitCountForSpawnUnitRecursively(GameObject creep)
    {
        int       count    = 0;
        UnitCreep creepCom = creep.GetComponent <UnitCreep>();

        if (creepCom.spawnUponDestroyed != null)
        {
            count += creepCom.spawnNumber;
            count += GetUnitCountForSpawnUnitRecursively(creepCom.spawnUponDestroyed) * creepCom.spawnNumber;
        }
        return(count);
    }
Ejemplo n.º 6
0
    UnitCreep GetCreep(Vector3 pointer)
    {
        LayerMask mask = 1 << LayerManager.LayerCreep() | 1 << LayerManager.LayerCreepF();

        Ray        ray = Camera.main.ScreenPointToRay(pointer);
        RaycastHit hit;

        if (!Physics.Raycast(ray, out hit, Mathf.Infinity, mask))
        {
            return(null);
        }

        UnitCreep creep = hit.transform.gameObject.GetComponent <UnitCreep>();

        return(creep);
    }
Ejemplo n.º 7
0
    void Start()
    {
        int rscCount = GameControl.GetResourceCount();

        if (defaultPath == null)
        {
            defaultPath = (PathTD)FindObjectOfType(typeof(PathTD));
        }

        if (autoGenWave)
        {
            InitAutoGenCreepPara();
            if (spawnLimit == _SpawnLimit.Finite)
            {
                for (int i = 0; i < waves.Length; i++)
                {
                    waves[i] = GenerateWave(i);
                }
            }
        }
        else
        {
            //prespawn the unit
            foreach (Wave wave in waves)
            {
                foreach (SubWave subWave in wave.subWaves)
                {
                    if (subWave.unit != null)
                    {
                        UnitCreep unit = subWave.unit.GetComponent <UnitCreep>();
                        //make sure the creep value length match the resource count
                        if (unit != null)
                        {
                            unit.InitValue(rscCount);
                        }
                        ObjectPoolManager.New(subWave.unit, subWave.count);
                    }
                }
            }
        }

        //LoadCreep();
    }
Ejemplo n.º 8
0
    void HPAttributeEditor(int index)
    {
        float startY = 133;
        float startX = 340;

        float space = 105;

        UnitCreep creep = creepList[index];

        EditorGUI.LabelField(new Rect(startX, startY, 200, height), "Creep HP: ");
        creep.HPAttribute.fullHPDefault = EditorGUI.FloatField(new Rect(startX + space, startY, 50, height - 2), creep.HPAttribute.fullHPDefault);
        //~ creep.HPAttribute.HP=creep.HPAttribute.fullHP;

        EditorGUI.LabelField(new Rect(startX, startY + 20, 200, height), "Creep Shield: ");
        creep.HPAttribute.fullShieldDefault = EditorGUI.FloatField(new Rect(startX + space, startY += 20, 50, height - 2), creep.HPAttribute.fullShieldDefault);

        if (creep.HPAttribute.fullShieldDefault > 0)
        {
            EditorGUI.LabelField(new Rect(startX, startY + 20, 200, height), "Shield Recharge: ");
            creep.HPAttribute.shieldRechargeRate = EditorGUI.FloatField(new Rect(startX + space, startY += 20, 50, height - 2), creep.HPAttribute.shieldRechargeRate);

            EditorGUI.LabelField(new Rect(startX, startY + 20, 200, height), "Shield Stagger: ");
            creep.HPAttribute.shieldStagger = EditorGUI.FloatField(new Rect(startX + space, startY += 20, 50, height - 2), creep.HPAttribute.shieldStagger);
        }

        startY = 133;
        startX = 340 + 105 + 50 + 10;
        space  = 100;

        EditorGUI.LabelField(new Rect(startX, startY, 200, height), "HP Overlay: ");
        creep.HPAttribute.overlayHP = (Transform)EditorGUI.ObjectField(new Rect(startX + space, startY, 100, height - 2), creep.HPAttribute.overlayHP, typeof(Transform), false);

        EditorGUI.LabelField(new Rect(startX, startY += spaceY, 200, height), "Shield Overlay: ");
        creep.HPAttribute.overlayShield = (Transform)EditorGUI.ObjectField(new Rect(startX + space, startY, 100, height - 2), creep.HPAttribute.overlayShield, typeof(Transform), false);

        EditorGUI.LabelField(new Rect(startX, startY += spaceY, 200, height), "Base Overlay: ");
        creep.HPAttribute.overlayBase = (Transform)EditorGUI.ObjectField(new Rect(startX + space, startY, 100, height - 2), creep.HPAttribute.overlayBase, typeof(Transform), false);

        EditorGUI.LabelField(new Rect(startX, startY += spaceY, 200, height), "Always Show Overlay: ");
        creep.HPAttribute.alwaysShowOverlay           = EditorGUI.Toggle(new Rect(startX + space + 40, startY, 100, height - 2), creep.HPAttribute.alwaysShowOverlay);
    }
Ejemplo n.º 9
0
    void Awake()
    {
        unit = gameObject.GetComponent <UnitCreep>();
        if (unit == null)
        {
            return;
        }

        if (animationAttack != null)
        {
            unit.SetAttackAnimation(animationAttack);
        }
        if (animationIdle != null)
        {
            unit.SetIdleAnimation(animationIdle);
        }

        if (shootObject != null)
        {
            ObjectPoolManager.New(shootObject, 2);
        }

        UpdateShootPointNBarrelObj();
    }
Ejemplo n.º 10
0
    public void CheckCreepList(Collider other)
    {
        for (int a = 0; a < m_TowerSoliderController.m_CheckSoliderList.Count; a++)
        {
            if (other.transform == m_TowerSoliderController.m_CheckSoliderList [a].transform)
            {
                m_Checkindex = 1;
            }
        }

        if (m_Checkindex == 0)
        {
            if (m_BlackCreep.Count < m_BlackMax)
            {
                m_UnitCreep = other.gameObject.GetComponent <UnitCreep> ();
                m_BlackCreep.Add(other.transform);
                m_TowerSoliderController.m_CheckSoliderList.Add(other.transform);
                m_UnitCreep.stopToAttack         = true;
                m_UnitCreep.attackLimitPerStop   = 1;
                m_UnitCreep.stopToAttackCooldown = 0.1f;
            }
        }
        m_Checkindex = 0;
    }
Ejemplo n.º 11
0
    internal void SetTarget(UnitCreep unitCreep)
    {
        target = unitCreep;
        Tower.SetTarget(unitCreep);

        if (targetIndicator != null)
        {
            targetIndicator.position = unitCreep.transform.position;
        }
        else
        {
            Debug.LogError("No target indicator " + this.name);
        }
    }
Ejemplo n.º 12
0
 void SingleDot(UnitCreep unit, Dot dot)
 {
     unit.ApplyDot(dot, 0);
 }
Ejemplo n.º 13
0
 void SingleStun(UnitCreep unit, float duration)
 {
     unit.ApplyStun(duration);
 }
Ejemplo n.º 14
0
 void SingleSlow(UnitCreep unit, Slow slow)
 {
     unit.ApplySlow(slow);
 }
Ejemplo n.º 15
0
 void SingleDamage(UnitCreep unit, float dmg)
 {
     unit.ApplyDamage(dmg, 0);
 }
Ejemplo n.º 16
0
    //actual spawning routine, responsible for spawning one type of creep only
    IEnumerator SpawnSubwave(SubWave subWave, Wave parentWave, int waveID)
    {
        yield return(new WaitForSeconds(subWave.delay));

        int spawnCount = 0;

        while (spawnCount < subWave.count)
        {
            Vector3    pos;
            Quaternion rot;

            PathTD tempPath;
            if (subWave.path == null)
            {
                tempPath = defaultPath;
            }
            else
            {
                tempPath = subWave.path;
            }

            pos = tempPath.waypoints[0].position;
            rot = tempPath.waypoints[0].rotation;

            GameObject obj = ObjectPoolManager.Spawn(subWave.unit, pos, rot);
            //Unit unit=obj.GetComponent<Unit>();
            UnitCreep unit = obj.GetComponent <UnitCreep>();

            if (subWave.overrideHP > 0)
            {
                unit.SetFullHP(subWave.overrideHP);
            }
            if (subWave.overrideShield > 0)
            {
                unit.SetFullShield(subWave.overrideShield);
            }
            if (subWave.overrideMoveSpd > 0)
            {
                unit.SetMoveSpeed(subWave.overrideMoveSpd);
            }
            if (subWave.overrideLifeCost >= 0)
            {
                unit.SetLifeCost(subWave.overrideLifeCost);
            }
            bool overrideValue = false;
            if (subWave.overrideValue.Length >= 0)
            {
                foreach (float val in subWave.overrideValue)
                {
                    if (val > 0)
                    {
                        overrideValue = true;
                    }
                }
            }
            if (overrideValue)
            {
                unit.SetValue(subWave.overrideValue);
            }

            unit.Init(tempPath, totalSpawnCount, waveID);
            unit.pathLooping = pathLooing;

            totalSpawnCount += 1;

            parentWave.activeUnitCount += 1;

            spawnCount += 1;
            if (spawnCount == subWave.count)
            {
                break;
            }

            yield return(new WaitForSeconds(subWave.interval));
        }

        subWave.spawned = true;
    }
Ejemplo n.º 17
0
    void Awake()
    {
        unit=gameObject.GetComponent<UnitCreep>();
        if(unit==null) return;

        if(animationAttack!=null) unit.SetAttackAnimation(animationAttack);
        if(animationIdle!=null) unit.SetIdleAnimation(animationIdle);

        if(shootObject!=null) ObjectPoolManager.New(shootObject, 2);
    }
Ejemplo n.º 18
0
    public void Dead()
    {
        //~ if(PerkManager.rscGainCreepChance>0 && Random.Range(0f, 1f)>=PerkManager.rscGainCreepChance){
        //~ int[] val=new int[value.Length];
        //~ for(int i=0; i<value.Length; i++){
        //~ float modifier=1+PerkManager.rscGainCreepModifier[i]+PerkManager.rscGainModifier[i];
        //~ float bonus=PerkManager.rscGainCreepValue[i]+PerkManager.rscGainValue[i];
        //~ val[i]=(int)Mathf.Round((float)value[i]*modifier+bonus);
        //~ }
        //~ GameControl.GainResource(val);
        //~ }
        //~ else GameControl.GainResource(value);

        //value length is verified as soon as game start so it never exceed actual resource length
        if (PerkManager.rscGainChance > 0 || PerkManager.rscGainCreepChance > 0)
        {
            float randG = Random.Range(0f, 1f);
            float randC = Random.Range(0f, 1f);
            int[] val   = new int[value.Length];

            for (int i = 0; i < value.Length; i++)
            {
                float modifier = 1;
                float bonus    = 0;

                if (randG <= PerkManager.rscGainChance)
                {
                    modifier += PerkManager.rscGainModifier[i];
                    bonus    += PerkManager.rscGainValue[i];
                }
                if (randC <= PerkManager.rscGainTowerChance)
                {
                    modifier += PerkManager.rscGainCreepModifier[i];
                    bonus    += PerkManager.rscGainCreepValue[i];
                }

                val[i] = (int)Mathf.Round((float)value[i] * modifier + bonus);
            }
            GameControl.GainResource(val);

            if (onGainResourceE != null)
            {
                GainResourcePos grp = new GainResourcePos(thisT.position, val);
                onGainResourceE(grp);
            }
        }
        else
        {
            GameControl.GainResource(value);

            if (onGainResourceE != null)
            {
                GainResourcePos grp = new GainResourcePos(thisT.position, value);
                onGainResourceE(grp);
            }
        }


        if (deadEffect != null)
        {
            ObjectPoolManager.Spawn(deadEffect, thisT.position, Quaternion.identity);
        }
        float duration = PlayDead();

        StartCoroutine(Unspawn(duration));

        //spawn more unit if there's one assigned
        if (spawnUponDestroyed != null)
        {
            SpawnManager.AddActiveUnit(waveID, spawnNumber);

            for (int i = 0; i < spawnNumber; i++)
            {
                //generate a small offset position within the grid size so not all creep spawned on top of each other and not too far apart
                float allowance = BuildManager.GetGridSize() / 2;

                float x = Random.Range(-allowance, allowance);
                float y = Random.Range(-allowance, allowance);

                Vector3    pos = thisT.position + new Vector3(x, 0, y);
                GameObject obj = ObjectPoolManager.Spawn(spawnUponDestroyed, pos, thisT.rotation);

                UnitCreep unit = obj.GetComponent <UnitCreep>();
                unit.Init(path, SpawnManager.NewUnitID(), waveID);
                //resume the path currently followed by this unit

                unit.StartCoroutine(unit.ResumeParentPath(wpMode, wp, wpCounter, currentPS, subPath, currentPathID, subWPCounter));
            }
        }
    }
Ejemplo n.º 19
0
 public override void OnEnemyThrough(UnitCreep u)
 {
     nextTypes.Add(bubbleTypeCount + 1);
 }
Ejemplo n.º 20
0
    float CreepAttackComEditor(int index)
    {
        float startY = 250;
        float startX = 340;


        UnitCreep creep = creepList[index];

        EditorGUI.LabelField(new Rect(startX, startY, 200, 20), "Attack/Support Creep:");

        UnitCreepAttack creepA = creep.gameObject.GetComponent <UnitCreepAttack>();

        if (creepA == null)
        {
            cont = new GUIContent("Add Com", "Make this creep available for attack tower or support creep");
            if (GUI.Button(new Rect(startX + 300 - 110, startY, 110, 20), "Add Com"))
            {
                creepA = creep.gameObject.AddComponent <UnitCreepAttack>();
            }
            else
            {
                return(startY);
            }
        }
        else
        {
            cont = new GUIContent("Remove Com", "Remove creep ability to attack tower or support creep");
            if (GUI.Button(new Rect(startX + 300 - 110, startY, 110, 20), "Remove Com"))
            {
                DestroyImmediate(creepA, true);
            }
        }

        startY += 10;

        int creepAType = (int)creepA.type;

        cont  = new GUIContent("Type:", "select the type of this creep (offensive/support)");
        contL = new GUIContent[creepTypeLabel.Length];
        for (int i = 0; i < contL.Length; i++)
        {
            contL[i] = new GUIContent(creepTypeLabel[i], creepTypeTooltip[i]);
        }
        creepAType  = EditorGUI.Popup(new Rect(startX, startY += spaceY, 300, 15), cont, creepAType, contL);
        creepA.type = (_AttackCreepType)creepAType;

        int creepAMode = (int)creepA.attackMode;

        cont  = new GUIContent("Mode:", "select the attacking behaviour of this creep");
        contL = new GUIContent[attModeLabel.Length];
        for (int i = 0; i < contL.Length; i++)
        {
            contL[i] = new GUIContent(attModeLabel[i], attModeTooltip[i]);
        }
        creepAMode        = EditorGUI.Popup(new Rect(startX, startY += spaceY, 300, 15), cont, creepAMode, contL);
        creepA.attackMode = (_AttackMode)creepAMode;

        if (creepA.type == _AttackCreepType.Attack)
        {
            int targetArea = (int)creepA.targetArea;
            cont  = new GUIContent("Target Area:", "select the targeting area of this creep");
            contL = new GUIContent[tgtAreaLabel.Length];
            for (int i = 0; i < contL.Length; i++)
            {
                contL[i] = new GUIContent(tgtAreaLabel[i], tgtAreaTooltip[i]);
            }
            targetArea        = EditorGUI.Popup(new Rect(startX, startY += spaceY, 300, 15), cont, targetArea, contL);
            creepA.targetArea = (_TargetingA)targetArea;

            cont = new GUIContent("frontalConeAngle:", "angle of the fontal cone targeting area. larger value indicate larger area. (0-360)");
            if (targetArea == 1)
            {
                creepA.frontalConeAngle = EditorGUI.FloatField(new Rect(startX, startY += spaceY, 300, height - 3), "frontalConeAngle:", creepA.frontalConeAngle);
            }


            int attackMethod = (int)creepA.attackMethod;
            cont  = new GUIContent("Attack Method:", "select between range or melee attack");
            contL = new GUIContent[attMethodLabel.Length];
            for (int i = 0; i < contL.Length; i++)
            {
                contL[i] = new GUIContent(attMethodLabel[i], attMethodTooltip[i]);
            }
            attackMethod        = EditorGUI.Popup(new Rect(startX, startY += spaceY, 300, 15), cont, attackMethod, contL);
            creepA.attackMethod = (_AttackMethod)attackMethod;

            int cdTracking = (int)creepA.cdTracking;
            cont  = new GUIContent("CDTracking:", "select cooldown tracking mode");
            contL = new GUIContent[cdTrackingLabel.Length];
            for (int i = 0; i < contL.Length; i++)
            {
                contL[i] = new GUIContent(cdTrackingLabel[i], cdTrackingTooltip[i]);
            }
            cdTracking        = EditorGUI.Popup(new Rect(startX, startY += spaceY, 300, 15), cont, cdTracking, contL);
            creepA.cdTracking = (_CDTracking)cdTracking;

            startY += 5;

            if (creepA.attackMethod == _AttackMethod.Range)
            {
                creepA.range = EditorGUI.FloatField(new Rect(startX, startY += spaceY, 300, height - 3), "AttackRange:", creepA.range);
            }
            else if (creepA.attackMethod == _AttackMethod.Melee)
            {
                creepA.range = EditorGUI.FloatField(new Rect(startX, startY += spaceY, 300, height - 3), "TargetRange:", creepA.range);
            }


            creepA.cooldown   = EditorGUI.FloatField(new Rect(startX, startY += spaceY, 300, height - 3), "AttackCooldown:", creepA.cooldown);
            creepA.damage     = EditorGUI.FloatField(new Rect(startX, startY += spaceY, 300, height - 3), "Damage:", creepA.damage);
            creepA.damageType = EditorGUI.IntField(new Rect(startX, startY += spaceY, 300, height - 3), "DamageType:", creepA.damageType);
            creepA.stun       = EditorGUI.FloatField(new Rect(startX, startY += spaceY, 300, height - 3), "StunDuration:", creepA.stun);

            startY += 5;

            if (creepA.attackMethod == _AttackMethod.Range)
            {
                creepA.turretObject = (Transform)EditorGUI.ObjectField(new Rect(startX, startY += spaceY, 300, 17), "TurretObject:", creepA.turretObject, typeof(Transform), false);

                if (creepA.turretObject != null)
                {
                    int turretAnimateMode = (int)creepA.animateTurret;
                    cont  = new GUIContent("TurretAnimateMode:", "How turret rotation behaves in reaction to target");
                    contL = new GUIContent[turretAnimateModeLabel.Length];
                    for (int i = 0; i < contL.Length; i++)
                    {
                        contL[i] = new GUIContent(turretAnimateModeLabel[i], turretAnimateModeTooltip[i]);
                    }
                    turretAnimateMode = EditorGUI.Popup(new Rect(startX, startY += 20, 300, 15), cont, turretAnimateMode, contL);
                    //~ turretAnimateMode = EditorGUI.Popup(new Rect(startX, startY+=20, 300, 15), "TurretAnimateMode:", turretAnimateMode, turretAnimateModeLabel);
                    creepA.animateTurret = (_TurretAni)turretAnimateMode;

                    if (turretAnimateMode == 0)
                    {
                        int turretRotationMode = (int)creepA.turretRotationModel;
                        cont  = new GUIContent("TurretRotationMode:", "The rotation mode of turret with respect to barrel");
                        contL = new GUIContent[turretRotationModeLabel.Length];
                        for (int i = 0; i < contL.Length; i++)
                        {
                            contL[i] = new GUIContent(turretRotationModeLabel[i], turretRotationModeTooltip[i]);
                        }
                        turretRotationMode         = EditorGUI.Popup(new Rect(startX, startY += 20, 300, 15), cont, turretRotationMode, contL);
                        creepA.turretRotationModel = (_RotationMode)turretRotationMode;
                    }
                    else
                    {
                        startY += 20;
                    }

                    int turretLOSMode = (int)creepA.losMode;
                    cont  = new GUIContent("TurretLOSMode:", "The line of sight mechanic used with the tower");
                    contL = new GUIContent[turretLOSModeLabel.Length];
                    for (int i = 0; i < contL.Length; i++)
                    {
                        contL[i] = new GUIContent(turretLOSModeLabel[i], turretLOSModeTooltip[i]);
                    }
                    turretLOSMode  = EditorGUI.Popup(new Rect(startX, startY += 20, 300, 15), cont, turretLOSMode, contL);
                    creepA.losMode = (_LOSMode)turretLOSMode;
                }

                int spLength = creepA.shootPoint.Length;
                cont     = new GUIContent("ShootPointCount:", "number of shootpoint. each shootpoint is a empty transform indicate position where the shootObject should be fired from");
                spLength = EditorGUI.IntField(new Rect(startX, startY += spaceY, 300, height - 3), cont, spLength);   startY -= 1;
                if (spLength != creepA.shootPoint.Length)
                {
                    creepA.shootPoint = CloneTransformList(creepA.shootPoint, spLength);
                }
                for (int i = 0; i < creepA.shootPoint.Length; i++)
                {
                    creepA.shootPoint[i] = (Transform)EditorGUI.ObjectField(new Rect(startX, startY += spaceY, 300, 17), " 	- " + i + ": ", creepA.shootPoint[i], typeof(Transform), false);
                }

                cont = new GUIContent("ShootObject:", "the object to be fired by the creep range attack (must contain a ShootObject component)");
                creepA.shootObject = (GameObject)EditorGUI.ObjectField(new Rect(startX, startY += spaceY, 300, 17), cont, creepA.shootObject, typeof(GameObject), false);
            }

            startY += 5;

            creepA.attackSound     = (AudioClip)EditorGUI.ObjectField(new Rect(startX, startY += spaceY, 300, 17), "AttackSound:", creepA.attackSound, typeof(AudioClip), false);
            creepA.animationIdle   = (AnimationClip)EditorGUI.ObjectField(new Rect(startX, startY += spaceY, 300, 17), "IdleAnimation:", creepA.animationIdle, typeof(AnimationClip), false);
            creepA.animationAttack = (AnimationClip)EditorGUI.ObjectField(new Rect(startX, startY += spaceY, 300, 17), "AttackAnimation:", creepA.animationAttack, typeof(AnimationClip), false);
            if (creepA.animationAttack != null)
            {
                creepA.aniAttackTimeOffset = EditorGUI.FloatField(new Rect(startX, startY += spaceY, 300, height - 3), "AttackAnimationTimeOffset::", creepA.aniAttackTimeOffset);
            }
        }
        else if (creepA.type == _AttackCreepType.Support)
        {
            //~ if(creep.attackMode==_AttackMode.RunNGun) attackMode=0;

            creepA.range = EditorGUI.FloatField(new Rect(startX, startY += spaceY, 300, height - 3), "EffectiveRange:", creepA.range);

            startY += 10;

            EditorGUI.LabelField(new Rect(startX, startY += spaceY, 200, 20), "Buff:");
            creepA.buff.damageBuff   = EditorGUI.FloatField(new Rect(startX, startY += spaceY, 300, height - 3), " - DamageBuff:", creepA.buff.damageBuff);
            creepA.buff.rangeBuff    = EditorGUI.FloatField(new Rect(startX, startY += spaceY, 300, height - 3), " - RangeBuff:", creepA.buff.rangeBuff);
            creepA.buff.cooldownBuff = EditorGUI.FloatField(new Rect(startX, startY += spaceY, 300, height - 3), " - cooldownBuff:", creepA.buff.cooldownBuff);
            creepA.buff.regenHP      = EditorGUI.FloatField(new Rect(startX, startY += spaceY, 300, height - 3), " - HPRegenRate:", creepA.buff.regenHP);

            startY += 10;

            //~ int spLength=creepA.sp.Length;
            //~ spLength=EditorGUI.IntField(new Rect(startX, startY+=spaceY, 300, height-3), "ShootPointCount:", spLength);	startY-=1;
            //~ if(spLength!=creepA.sp.Length) creepA.sp=CloneTransformList(creepA.sp, spLength);
            //~ for(int i=0; i<creepA.sp.Length; i++){
            //~ creepA.sp[i]=(Transform)EditorGUI.ObjectField(new Rect(startX, startY+=spaceY, 300, 17), "  - "+i+": ", creepA.sp[i], typeof(Transform), false);
            //~ }
            //~ creepA.shootObject=(GameObject)EditorGUI.ObjectField(new Rect(startX, startY+=spaceY, 300, 17), "ShootObject:", creepA.shootObject, typeof(GameObject), false);
            //~ creepA.cooldown = EditorGUI.FloatField(new Rect(startX, startY+=spaceY, 300, height-3), "EffectCooldown:", creepA.cooldown);
            creepA.animationIdle = (AnimationClip)EditorGUI.ObjectField(new Rect(startX, startY += spaceY, 300, 17), "IdleAnimation:", creepA.animationIdle, typeof(AnimationClip), false);
        }


        return(startY);
    }
Ejemplo n.º 21
0
    void OnGUI()
    {
        if (window == null)
        {
            Init();
        }

        Rect visibleRect = new Rect(0, 0, window.position.width, window.position.height);
        Rect contentRect = new Rect(0, 0, window.position.width - 15, contentHeight);

        scrollPos = GUI.BeginScrollView(visibleRect, scrollPos, contentRect);
        //~ scrollPos = GUI.BeginScrollView(new Rect(0, 0, window.position.width, window.position.height), scrollPos, new Rect(0, 0, Mathf.Max(window.position.width, 610+(levelCap-3)*180), 1410));

        GUI.changed = false;

        startX = 3;
        startY = 3;
        height = 18;
        //~ spaceY=height+startX;
        spaceY = height;

        if (creepList.Length > 0)
        {
            GUI.SetNextControlName("CreepSelect");
            index = EditorGUI.Popup(new Rect(startX, startY, 300, height), "Creep:", index, nameList);
            if (GUI.changed)
            {
                GUI.FocusControl("CreepSelect");
            }


            UnitCreep creep = creepList[index];


            //creep.unitName = EditorGUI.TextField(new Rect(startX, startY+=30, 300, height-3), "CreepName:", creep.unitName);

            EditorGUI.LabelField(new Rect(340, startY, 70, height), "Icon: ");
            creep.icon = (Texture)EditorGUI.ObjectField(new Rect(380, startY, 70, 70), creep.icon, typeof(Texture), false);


            HPAttributeEditor(index);

            startY         += 8;
            creep.moveSpeed = EditorGUI.FloatField(new Rect(startX, startY += spaceY, 300, height - 3), "moveSpeed:", creep.moveSpeed);
            creep.armorType = EditorGUI.IntField(new Rect(startX, startY += spaceY, 300, height - 3), "ArmorType:", creep.armorType);
            creep.flying    = EditorGUI.Toggle(new Rect(startX, startY += spaceY, 300, height - 3), "Flying:", creep.flying);
            if (creep.flying)
            {
                creep.flightHeightOffset = EditorGUI.FloatField(new Rect(startX, startY += 20, 300, height - 3), "Flight Height Offset:", creep.flightHeightOffset);
            }

            creep.lifeCost     = EditorGUI.IntField(new Rect(startX, startY += spaceY, 300, height - 3), "LifeCost:", creep.lifeCost);
            creep.immuneToCrit = EditorGUI.Toggle(new Rect(startX, startY += spaceY, 300, height - 3), "ImmuneToCritical:", creep.immuneToCrit);
            creep.immuneToSlow = EditorGUI.Toggle(new Rect(startX, startY += spaceY, 300, height - 3), "ImmuneToSlow:", creep.immuneToSlow);


            EditorGUI.LabelField(new Rect(startX, startY += spaceY + 5, 300, height - 3), "Value:");
            if (rscList.Count != creep.value.Length)
            {
                creep.value = UpdateValueLength(creep.value, rscList.Count);
            }
            for (int i = 0; i < creep.value.Length; i++)
            {
                creep.value[i] = EditorGUI.IntField(new Rect(startX, startY += spaceY, 300, height - 3), " - " + rscList[i].name + ":", creep.value[i]);
            }
            startY += 5;



            creep.targetPointT = (Transform)EditorGUI.ObjectField(new Rect(startX, startY += spaceY, 300, 17), "TargetPoint: ", creep.targetPointT, typeof(Transform), false);

            startY += 10;

            cont = new GUIContent("SpawnEffect:", "The visual effect to spawn when this creep is spawned");
            creep.spawnEffect = (GameObject)EditorGUI.ObjectField(new Rect(startX, startY += spaceY, 300, 17), "SpawnEffect: ", creep.spawnEffect, typeof(GameObject), false);
            cont              = new GUIContent("DeadEffect:", "The visual effect to spawn when this creep is destroyed");
            creep.deadEffect  = (GameObject)EditorGUI.ObjectField(new Rect(startX, startY += spaceY, 300, 17), "DeadEffect: ", creep.deadEffect, typeof(GameObject), false);
            cont              = new GUIContent("ScoreEffect:", "The visual effect to spawn when this creep has reached its final waypoint");
            creep.scoreEffect = (GameObject)EditorGUI.ObjectField(new Rect(startX, startY += spaceY, 300, 17), "ScoreEffect: ", creep.scoreEffect, typeof(GameObject), false);

            startY += 10;

            //~ int targetArea=(int)creepA.targetArea;
            //~ cont=new GUIContent("Target Area:", "select the targeting area of this creep");
            //~ contL=new GUIContent[tgtAreaLabel.Length];
            //~ for(int i=0; i<contL.Length; i++) contL[i]=new GUIContent(tgtAreaLabel[i], tgtAreaTooltip[i]);

            cont = new GUIContent("SpawnUnitUponDestroyed:", "The creep to spawn when this creep is destroyed,");
            //~ creep.spawnUponDestroyed=(GameObject)EditorGUI.ObjectField(new Rect(startX, startY+=spaceY, 300, 17), "SpawnUnitUponDestroyed: ", creep.spawnUponDestroyed, typeof(GameObject), false);
            creep.spawnUponDestroyed = (GameObject)EditorGUI.ObjectField(new Rect(startX, startY += spaceY, 300, 17), cont, creep.spawnUponDestroyed, typeof(GameObject), false);
            if (creep.spawnUponDestroyed != null)
            {
                cont = new GUIContent(" - Count:", "The creep to spawn when this creep is destroyed,");
                //~ creep.spawnNumber = EditorGUI.IntField(new Rect(startX, startY+=spaceY, 300, height-3), " - Count:", creep.spawnNumber);
                creep.spawnNumber = EditorGUI.IntField(new Rect(startX, startY += spaceY, 300, height - 3), cont, creep.spawnNumber);
            }
            else
            {
                startY += spaceY;
            }

            startY += 10;

            showAnimation = EditorGUI.Foldout(new Rect(startX, startY += 30, 300, height - 3), showAnimation, "Animation:");
            //EditorGUI.LabelField(new Rect(startX, startY+=30, 300, height-3), "Animation:");	//startY-=3;

            if (showAnimation)
            {
                cont = new GUIContent("AnimationBody:", "The root gameObject that hold the animation component for the animation");
                creep.animationBody = (GameObject)EditorGUI.ObjectField(new Rect(startX, startY += spaceY, 300, 17), "AnimationBody: ", creep.animationBody, typeof(GameObject), false);
                cont = new GUIContent("MoveAnimationModifier:", "The speed modifier for the move animation, adjust to match move animation to move speed");
                creep.moveAnimationModifier = EditorGUI.FloatField(new Rect(startX, startY += 20, 300, height - 3), "MoveAnimationModifier:", creep.moveAnimationModifier);

                startY += 5;

                int aniLength = 0;
                aniLength = creep.animationMove.Length;
                aniLength = EditorGUI.IntField(new Rect(startX, startY += spaceY, 300, height - 3), " - Move Animation:", aniLength);
                if (aniLength != creep.animationMove.Length)
                {
                    creep.animationMove = MatchAnimationArrayLength(creep.animationMove, aniLength);
                }
                for (int i = 0; i < aniLength; i++)
                {
                    creep.animationMove[i] = (AnimationClip)EditorGUI.ObjectField(new Rect(startX, startY += spaceY, 300, 17), " 	- "+ i + ": ", creep.animationMove[i], typeof(AnimationClip), false);
                }

                aniLength = creep.animationSpawn.Length;
                aniLength = EditorGUI.IntField(new Rect(startX, startY += spaceY, 300, height - 3), " - Spawn Animation:", aniLength);
                if (aniLength != creep.animationSpawn.Length)
                {
                    creep.animationSpawn = MatchAnimationArrayLength(creep.animationSpawn, aniLength);
                }
                for (int i = 0; i < aniLength; i++)
                {
                    creep.animationSpawn[i] = (AnimationClip)EditorGUI.ObjectField(new Rect(startX, startY += spaceY, 300, 17), " 	- "+ i + ": ", creep.animationSpawn[i], typeof(AnimationClip), false);
                }

                aniLength = creep.animationHit.Length;
                aniLength = EditorGUI.IntField(new Rect(startX, startY += spaceY, 300, height - 3), " - Hit Animation:", aniLength);
                if (aniLength != creep.animationHit.Length)
                {
                    creep.animationHit = MatchAnimationArrayLength(creep.animationHit, aniLength);
                }
                for (int i = 0; i < aniLength; i++)
                {
                    creep.animationHit[i] = (AnimationClip)EditorGUI.ObjectField(new Rect(startX, startY += spaceY, 300, 17), " 	- "+ i + ": ", creep.animationHit[i], typeof(AnimationClip), false);
                }

                aniLength = creep.animationDead.Length;
                aniLength = EditorGUI.IntField(new Rect(startX, startY += spaceY, 300, height - 3), " - Dead Animation:", aniLength);
                if (aniLength != creep.animationDead.Length)
                {
                    creep.animationDead = MatchAnimationArrayLength(creep.animationDead, aniLength);
                }
                for (int i = 0; i < aniLength; i++)
                {
                    creep.animationDead[i] = (AnimationClip)EditorGUI.ObjectField(new Rect(startX, startY += spaceY, 300, 17), " 	- "+ i + ": ", creep.animationDead[i], typeof(AnimationClip), false);
                }

                aniLength = creep.animationScore.Length;
                aniLength = EditorGUI.IntField(new Rect(startX, startY += spaceY, 300, height - 3), " - Score Animation:", aniLength);
                if (aniLength != creep.animationScore.Length)
                {
                    creep.animationScore = MatchAnimationArrayLength(creep.animationScore, aniLength);
                }
                for (int i = 0; i < aniLength; i++)
                {
                    creep.animationScore[i] = (AnimationClip)EditorGUI.ObjectField(new Rect(startX, startY += spaceY, 300, 17), " 	- "+ i + ": ", creep.animationScore[i], typeof(AnimationClip), false);
                }
            }


            showAudio = EditorGUI.Foldout(new Rect(startX, startY += 30, 300, height - 3), showAudio, "Audio:");
            //EditorGUI.LabelField(new Rect(startX, startY+=30, 300, height-3), "Audio:");	//startY-=3;
            if (showAudio)
            {
                creep.audioSpawn = (AudioClip)EditorGUI.ObjectField(new Rect(startX, startY += spaceY, 300, 17), " - AudioSpawn: ", creep.audioSpawn, typeof(AudioClip), false);
                creep.audioHit   = (AudioClip)EditorGUI.ObjectField(new Rect(startX, startY += spaceY, 300, 17), " - AudioHit: ", creep.audioHit, typeof(AudioClip), false);
                creep.audioDead  = (AudioClip)EditorGUI.ObjectField(new Rect(startX, startY += spaceY, 300, 17), " - AudioDead: ", creep.audioDead, typeof(AudioClip), false);
                creep.audioScore = (AudioClip)EditorGUI.ObjectField(new Rect(startX, startY += spaceY, 300, 17), " - AudioScore: ", creep.audioScore, typeof(AudioClip), false);
            }
            float anchorY = startY + 5;

            float y = CreepAttackComEditor(index) + 5;

            contentHeight = Mathf.Max(y, anchorY);

            if (GUI.changed)
            {
                EditorUtility.SetDirty(creep);
            }
        }


        GUI.EndScrollView();
    }
Ejemplo n.º 22
0
 //Call by inherited class UnitCreep, caching inherited UnitCreep instance to this instance
 public void SetSubClassInt(UnitCreep unit)
 {
     unitC=unit;
     subClass=_UnitSubClass.Creep;
 }
Ejemplo n.º 23
0
 //Call by inherited class UnitCreep, caching inherited UnitCreep instance to this instance
 public void SetSubClassInt(UnitCreep unit)
 {
     unitC    = unit;
     subClass = _UnitSubClass.Creep;
 }