Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        spawnTimer -= Time.deltaTime;

        if (spawnTimer <= 0f)
        {
            GameObject chosenEnemy = enemyPrefabs[Random.Range(0, enemyPrefabs.Count)];

            int       randomPath = Random.Range(0, paths.Count);
            EnemyPath chosenPath = paths[randomPath];

            chosenEnemy.GetComponent <TravelPath>().pathToFollow = chosenPath.nodes;
            chosenEnemy.GetComponent <TravelPath>().pathGO       = chosenPath.gameObject;
            chosenEnemy.GetComponent <TravelPath>().pathNum      = randomPath;

            GameObject instantiatedEnemy = Instantiate(chosenEnemy);
            spawnedEnemies.Add(instantiatedEnemy);

            instantiatedEnemy.transform.position = chosenPath.nodes[0].transform.position;

            spawnTimer = baseTimeBetweenSpawns + Random.Range(-spawnTimeRange, spawnTimeRange);

            if (EventManager.OnEnemySpawned != null)
            {
                EventManager.OnEnemySpawned(instantiatedEnemy.name, instantiatedEnemy.transform, chosenPath.name);
            }
        }
    }
Esempio n. 2
0
    private void Awake()
    {
        _path = new EnemyPath();
        _path.SetupWaypoints(transform.GetChild(0));

        tutorialManager = FindObjectOfType <TutorialManager>();
    }
Esempio n. 3
0
 // Use this for initialization
 void Start()
 {
     blastZone.SetActive(false);
     anim      = GetComponent <Animator> ();
     audio     = GetComponent <AudioSource> ();
     enemyPath = GetComponent <EnemyPath> ();
 }
Esempio n. 4
0
        public void Spawn(EnemyPath path, bool boss, float duration)
        {
            var p     = path == EnemyPath.Left ? _leftPositions : _rightPositions;
            var enemy = boss ? _bossPool.Spawn() : _minionPool.Spawn();

            enemy.transform.rotation = Quaternion.identity;
            enemy.transform.position = p[0];
            enemy.Type = boss ? EnemyType.Boss : EnemyType.Minion;
            enemy.Path = path;
            var tweener = new TweenerCore <Vector3, Path, PathOptions> [1];

            tweener[0] = enemy.transform.DOPath(p, duration, PathType.CatmullRom).OnUpdate(() =>
            {
                tweener[0].timeScale = GameTime.Scale;
                if (enemy.IsDead || !enemy.gameObject.activeSelf)
                {
                    tweener[0].Kill();
                }
            }).OnComplete(() =>
            {
                if (boss)
                {
                    _bossPool.Despawn(enemy);
                }
                else
                {
                    _minionPool.Despawn(enemy);
                }
            });
        }
Esempio n. 5
0
    private void OnSceneGUI()
    {
        path = target as EnemyPath;

        handleTransform = path.transform;

        if (Tools.pivotRotation == PivotRotation.Local)
        {
            handleRotation = handleTransform.rotation;
        }
        else
        {
            handleRotation = Quaternion.identity;
        }

        for (int i = 0; i < path.pathingPoints.Length; i++)
        {
            ShowPoint(i);

            if (i < path.pathingPoints.Length - 1)
            {
                Handles.DrawBezier(handleTransform.TransformPoint(path.GetPointLocation(i)), handleTransform.TransformPoint(path.GetPointLocation(i + 1)), handleTransform.TransformPoint(path.GetControlPoint(i, 1) + path.GetPointLocation(i)), handleTransform.TransformPoint(path.GetControlPoint(i + 1, 0) + path.GetPointLocation(i + 1)), Color.white, null, 2f);
            }
        }
    }
Esempio n. 6
0
 void Update()
 {
     if (m_Delay < m_EnemySpawningDelay)
     {
         m_Delay += Time.deltaTime;
     }
     else if (m_CurrentIndex < m_EnemyPrefabs.Count)
     {
         m_Delay = 0;
         GameObject enemy = Instantiate(m_EnemyPrefabs[m_CurrentIndex]);
         if (m_ShootDirection)
         {
             EnemyAI ai = enemy.GetComponent <EnemyAI> ();
             ai.SetShootDirection(m_ShootDirection);
         }
         if (m_Curve)
         {
             EnemyPath path = enemy.GetComponent <EnemyPath> ();
             path.SetPath(m_Curve);
         }
         enemy.transform.position = m_SpawningLocation.position;
         m_CurrentIndex++;
     }
     else
     {
         Destroy(this);
     }
 }
Esempio n. 7
0
    void Update()
    {
        if (GameManager.Instance.CurrentWave < Waves.Length)
        {
            for (int i = 0; i < Waves[GameManager.Instance.CurrentWave].Length(); i++)
            {
                _timeInterval[i] = Time.time - _lastSpawnTime[i];

                if (((_enemiesSpawned[i] == 0 && _timeInterval[i] >= timeBetweenWaves) ||
                     _timeInterval[i] >= Waves[GameManager.Instance.CurrentWave].spawnInterval[i]) &&
                    _enemiesSpawned[i] < Waves[GameManager.Instance.CurrentWave].maxEnemies[i])
                {
                    _lastSpawnTime[i] = Time.time;
                    GameObject enemy = Instantiate(Waves[GameManager.Instance.CurrentWave].enemyToSpawnPrefab[i]);
                    enemy.GetComponent <MoveEnemy>().Path = EnemyPath.GetShiftedPath(GameManager.Instance.LevelPath.WayPoints);
                    _enemiesSpawned[i]++;
                }
            }

            if (IsWaveFinished())
            {
                GameManager.Instance.CurrentWave++;
                for (int i = 0; i < Waves.Length; i++)
                {
                    _enemiesSpawned[i] = 0;
                    _lastSpawnTime[i]  = Time.time;
                }
                if (GameManager.Instance.CurrentWave < Waves.Length)
                {
                    StartCoroutine(GUIManager.Instance.ShowNextWaveText());
                }
            }
        }
    }
Esempio n. 8
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag.Equals("Enemy"))
     {
         enemyPath = other.GetComponent <EnemyPath>();
         enemyPath.ChaseNoisemaker(gameObject);
     }
 }
Esempio n. 9
0
 void Start()
 {
     cd           = cd_initial;
     range        = range_initial;
     bulletSpeed  = bulletSpeed_initial;
     enemyPath    = GetComponent <EnemyPath>();
     player       = GameObject.FindGameObjectWithTag("Player");
     attackTarget = player;
 }
Esempio n. 10
0
 private void OnEnable()
 {
     if (EnemyPath.points == null)
     {
         return;
     }
     transform.position = EnemyPath.GetFirstPoint();
     target             = EnemyPath.GetNextPoint(0);
     currentPoint       = 1;
 }
Esempio n. 11
0
    public override void OnInspectorGUI()
    {
        EnemyPath myScript = (EnemyPath)target;

        if (GUILayout.Button("Add Waypoint"))
        {
            myScript.AddWayPoint();
        }

        DrawDefaultInspector();
    }
Esempio n. 12
0
    public virtual void StartMoving(EnemyPath path)
    {
        _path = path;
        transform.DOPath(_path.GetPathAsVectorMassive(), _moveSpeed, PathType.Linear)
        .SetEase(Ease.Linear)
        .SetLookAt(MICRO_TIME_TO_ROTATE)
        .OnComplete(() =>
        {
            CompletePath();
        });

        Debug.Log(gameObject.name + " начал путь");
    }
Esempio n. 13
0
    private void Update()
    {
        float   diff;
        Vector3 tmp = transform.position;

        transform.position = Vector3.MoveTowards(transform.position, target, dataHolder.data.Speed * Time.deltaTime);
        diff      = Vector3.Distance(tmp, transform.position);
        distance += diff;
        if (diff < float.Epsilon)
        {
            target = EnemyPath.GetNextPoint(currentPoint);
            currentPoint++;
        }
    }
Esempio n. 14
0
    private void Start()
    {
        EnemyPath ep = FindObjectOfType <EnemyPath>();

        if (ep)
        {
            patrolPaths = ep.GetPaths();
        }
        EnemyPathLineUp eplu = FindObjectOfType <EnemyPathLineUp>();

        if (eplu)
        {
            lineUpPath = eplu.GetPaths();
        }
    }
    //spawn Enemy Group
    private IEnumerator IESpawnEnemyGroup(int pgroup)
    {
        m_IsSpawningEnemies = true;
        for (int i = 0; i < pgroup; i++)
        {
            int totalEnemies = Random.Range(m_MinTotalEnemies, m_MaxTotalEnemies);

            EnemyPath path = m_EnemyPath[Random.Range(0, m_EnemyPath.Length)];
            yield return(StartCoroutine(IESpawnEnemy(totalEnemies, path)));

            if (i < pgroup - 1)
            {
                yield return(new WaitForSeconds(3f / m_curWave.speedMultiplier));
            }
        }
        m_IsSpawningEnemies = false;
    }
Esempio n. 16
0
    private void OnSceneGUI()
    {
        EnemyPath path = (EnemyPath)target;


        for (int i = 0; i < path.nodes.Length; i++)
        {
            EditorGUI.BeginChangeCheck();

            Vector3 newTargetPosition = Handles.PositionHandle(path.nodes[i], Quaternion.identity);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(path, "Change path position");
                path.nodes[i] = newTargetPosition;
            }
        }
    }
    //spawn Enemy
    private IEnumerator IESpawnEnemy(int m_TotalEnemies, EnemyPath path)
    {
        for (int i = 0; i < m_TotalEnemies; i++)
        {
            yield return(new WaitUntil(() => m_Active));

            yield return(new WaitForSeconds(m_EnemySpawnInterval / m_curWave.speedMultiplier));

            //dung Instantiate lam ton dung luong memory
            //EnemyController enemy= Instantiate(m_EnemyPrefabs, null);

            // su dung pool
            EnemyController enemy = m_EnemiesPool.spawn(path.WayPoints[0].position, transform);

            //khoi tao duong di enemy
            enemy.Init(path.WayPoints, m_curWave.speedMultiplier);
        }
    }
Esempio n. 18
0
    public static EnemyPath GetShiftedPath(Vector3[] path)
    {
        var   shifterPath = new Vector3[path.Length];
        float xShift      = Random.Range(-1.0f, 1.0f);
        float yShift      = Random.Range(-1.0f, 1.0f);

        for (int i = 0; i < shifterPath.Length; i++)
        {
            shifterPath[i] = new Vector3
            {
                x = path[i].x + xShift,
                y = path[i].y + yShift
            };
        }
        EnemyPath result = (EnemyPath)ScriptableObject.CreateInstance("EnemyPath");

        result.WayPoints = shifterPath;
        return(result);
    }
    public static void BrowseSceneAndDoStuff()
    {
        GameObject[] all = (GameObject[])GameObject.FindObjectsOfType(typeof(GameObject));

        for (int i = 0; i < all.Length; i++)
        {
            if (!all[i].GetComponent <EnnemyBehaviour>())
            {
                continue;
            }
            EnnemyBehaviour eb = all[i].GetComponent <EnnemyBehaviour>();
            EnemyPath       ep = GameObject.FindObjectOfType(typeof(EnemyPath)) as EnemyPath;
            eb.pathFollow = ep;

            EditorUtility.SetDirty(eb);
        }

        Debug.Log("done successfully!");
    }
Esempio n. 20
0
        private void OnSceneGUI()
        {
            enemyPath = target as EnemyPath;

            if (enemyPath == null || enemyPath.WayPoints == null || enemyPath.WayPoints.Count <= 1)
            {
                return;
            }

            using (new Handles.DrawingScope(Matrix4x4.Translate(enemyPath.transform.position)))
            {
                Handles.color = enemyPath.PathColor;

                for (var index = 0; index < enemyPath.WayPoints.Count; index++)
                {
                    if (enemyPath.HandleVisualisation == HandleVisualisation.FreeMove)
                    {
                        float   y           = enemyPath.WayPoints[index].y;
                        Vector3 newWayPoint = Handles.FreeMoveHandle(enemyPath.WayPoints[index], Quaternion.identity, 1, Vector3.one, Handles.SphereHandleCap);

                        if (enemyPath.FixYAxis)
                        {
                            newWayPoint.y = y;
                        }
                        enemyPath.WayPoints[index] = newWayPoint;
                    }
                    else
                    {
                        float   y           = enemyPath.WayPoints[index].y;
                        Vector3 newWayPoint = Handles.PositionHandle(enemyPath.WayPoints[index], Quaternion.identity);

                        if (enemyPath.FixYAxis)
                        {
                            newWayPoint.y = y;
                        }
                        enemyPath.WayPoints[index] = newWayPoint;
                    }
                }

                EditorUtility.SetDirty(target);
            }
        }
Esempio n. 21
0
 private void Update()
 {
     if (isMoving == true && isVulnerable == false)
     {
         transform.position = Vector2.MoveTowards(transform.position, destination.transform.position, .05f);
     }
     if (Vector2.Distance(transform.position, destination.transform.position) < .1f && isMoving == true)
     {
         destination = destination.nextDestination;
         isMoving    = false;
         StartCoroutine(MovementDelay());
     }
     if (CheckLevers() && isVulnerable == false)
     {
         StartCoroutine(VulnerablePhase());
     }
     if (health <= 0)
     {
         Anim.SetTrigger("DeathState");
         EndOfPhase();
     }
 }
    void UpdateTarget()
    {
        float ClosestTarget = 0f;

        GameObject[] enemies = GameObject.FindGameObjectsWithTag(EnemyTag);
        foreach (GameObject Enemy in enemies)
        {
            EnemyPath E_Path          = Enemy.GetComponent <EnemyPath>();
            float     distanceToEnemy = Vector2.Distance(transform.position, Enemy.transform.position);
            if (distanceToEnemy <= range)
            {
                ClosestEnemy = E_Path.distanceTravelled;
                if (ClosestEnemy > ClosestTarget)
                {
                    ClosestTarget = ClosestEnemy;
                    TargetEnemy   = Enemy;
                    target        = TargetEnemy.transform;
                }
            }
        }
        if (TargetEnemy != null)
        {
            if (Vector2.Distance(transform.position, TargetEnemy.transform.position) > range)
            {
                TargetEnemy   = null;
                target        = null;
                ClosestTarget = 0;
            }
            else
            {
                if (useChimical)
                {
                    Chimical();
                    GameObject spawn = Instantiate(ChemTrail, TargetEnemy.transform.position, TargetEnemy.transform.rotation);
                    Stats.Shoot(spawn.GetComponent <ChimicalTrail>());
                }
            }
        }
    }
Esempio n. 23
0
    protected void SetupGeneral()
    {
        Health healthScript = GetComponent <Health> ();

        if (!healthScript)
        {
            healthScript = gameObject.AddComponent <Health> ();
        }
        healthScript.SetHealth(health);

        EnemyPath pathScript = GetComponent <EnemyPath> ();

        if (!pathScript)
        {
            pathScript = gameObject.AddComponent <EnemyPath> ();
        }
        pathScript.SetDamageOnCollision(dommageOnCollision);
        if (!path)
        {
            GameObject temp = Instantiate(pathPrefab);
            StartCoroutine(DestroyFirstWhenSecondDestroyed(temp, gameObject));
            path = temp.GetComponent <BezierCurve> ();
        }
        pathScript.SetPath(path);
        if (duration <= 0)
        {
            Debug.LogWarning("The duration given wasn't stricly positive, a default duration of 15 secondes will be given instead");
            duration = 15;
        }
        pathScript.SetDuration(duration);
        if (onHitSound)
        {
            pathScript.SetHitSound(onHitSound);
        }
        pathScript.SetLoop(loop);
        pathScript.SetHitColorTime(onHitColorTime > 0 ? onHitColorTime : 1);
    }
 // Use this for initialization
 void Start()
 {
     enemyPath = GetComponent <EnemyPath> ();        // Get the enemypath script.
 }
Esempio n. 25
0
 public void Activate()
 {
     path = LevelController.inst.path;
     transform.localPosition  += Vector3.right * Random.Range(-randPosRange, randPosRange);
     graphics.localEulerAngles = Vector3.up * Random.Range(0, 360);
 }
Esempio n. 26
0
    public override bool Reset(Enemy enemy)
    {
        if (enemy == null) return false;
        _myEnemy = enemy;

        _path = EnemyPathfinder.FindPath(_myEnemy, _target);
        if (_path == null) return false;

        //_path.DebugPrint();
        _curNode = 0;
        _path.NormalizeConnections(new Vector2(1, 1));
        MoveToNode(0);
        return true;
    }
Esempio n. 27
0
        public byte[] Write()
        {
            MemoryStream       m  = new MemoryStream();
            EndianBinaryWriter er = new EndianBinaryWriter(m, Endianness.LittleEndian);
            int NrSections        = 0;

            if (ObjectInformation != null)
            {
                NrSections++;
            }
            if (Path != null)
            {
                NrSections++;
            }
            if (Point != null)
            {
                NrSections++;
            }
            if (Stage != null)
            {
                NrSections++;
            }
            if (KartPointStart != null)
            {
                NrSections++;
            }
            if (KartPointJugem != null)
            {
                NrSections++;
            }
            if (KartPointSecond != null)
            {
                NrSections++;
            }
            if (KartPointCannon != null)
            {
                NrSections++;
            }
            if (KartPointMission != null)
            {
                NrSections++;
            }
            if (CheckPoint != null)
            {
                NrSections++;
            }
            if (CheckPointPath != null)
            {
                NrSections++;
            }
            if (ItemPoint != null)
            {
                NrSections++;
            }
            if (ItemPath != null)
            {
                NrSections++;
            }
            if (EnemyPoint != null)
            {
                NrSections++;
            }
            if (EnemyPath != null)
            {
                NrSections++;
            }
            if (MiniGameEnemyPoint != null)
            {
                NrSections++;
            }
            if (MiniGameEnemyPath != null)
            {
                NrSections++;
            }
            if (Area != null)
            {
                NrSections++;
            }
            if (Camera != null)
            {
                NrSections++;
            }
            Header.SectionOffsets = new UInt32[NrSections];
            Header.Write(er);

            int SectionIdx = 0;

            if (ObjectInformation != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                ObjectInformation.Write(er);
                SectionIdx++;
            }
            if (Path != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                Path.Write(er);
                SectionIdx++;
            }
            if (Point != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                Point.Write(er);
                SectionIdx++;
            }
            if (Stage != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                Stage.Write(er);
                SectionIdx++;
            }
            if (KartPointStart != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                KartPointStart.Write(er);
                SectionIdx++;
            }
            if (KartPointJugem != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                KartPointJugem.Write(er);
                SectionIdx++;
            }
            if (KartPointSecond != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                KartPointSecond.Write(er);
                SectionIdx++;
            }
            if (KartPointCannon != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                KartPointCannon.Write(er);
                SectionIdx++;
            }
            if (KartPointMission != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                KartPointMission.Write(er);
                SectionIdx++;
            }
            if (CheckPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                CheckPoint.Write(er);
                SectionIdx++;
            }
            if (CheckPointPath != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                CheckPointPath.Write(er);
                SectionIdx++;
            }
            if (ItemPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                ItemPoint.Write(er);
                SectionIdx++;
            }
            if (ItemPath != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                ItemPath.Write(er);
                SectionIdx++;
            }
            if (EnemyPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                EnemyPoint.Write(er);
                SectionIdx++;
            }
            if (EnemyPath != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                EnemyPath.Write(er);
                SectionIdx++;
            }
            if (MiniGameEnemyPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                MiniGameEnemyPoint.Write(er);
                SectionIdx++;
            }
            if (MiniGameEnemyPath != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                MiniGameEnemyPath.Write(er);
                SectionIdx++;
            }
            if (Area != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                Area.Write(er);
                SectionIdx++;
            }
            if (Camera != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                Camera.Write(er);
                SectionIdx++;
            }

            byte[] result = m.ToArray();
            er.Close();
            return(result);
        }
Esempio n. 28
0
    private void GeneratePathArrows(EnemyPath enemyPath, float distancePerArrow)
    {
        if (distancePerArrow <= 1e-5) {
          return;
        }

        List<Vector3> path = enemyPath.path;

        if (path.Count == 0) {
          return;
        }

        for (int i = 1; i < path.Count; ++i) {
          Vector3 arrowDirection = (path[i] - path[(i + path.Count - 1) % path.Count]).normalized;
          Quaternion arrowAngle = Quaternion.FromToRotation(Vector3.forward, arrowDirection);
          float distanceBetweenPoints = Vector3.Distance(path[i], path[(i + path.Count - 1) % path.Count]);
          float gapT = distancePerArrow / distanceBetweenPoints;
          if (distanceBetweenPoints <= 1e-5) {
        continue;
          }
          for (float t = gapT; t < 1; t += gapT) {
        Vector3 arrowPosition = Vector3.Lerp(path[(i + path.Count - 1) % path.Count], path[i], t)/* + new Vector3(0, 0.005f, 0) */;
        GameObject newArrow = Instantiate(pathArrow, arrowPosition, arrowAngle) as GameObject;
        newArrow.transform.parent = game.gameSceneParentTransform;
        newArrow.transform.localPosition = arrowPosition;
          }
        }
    }
Esempio n. 29
0
 void Start()
 {
     player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>();
     path   = new EnemyPath();
     SetState(EnemyState.Idle);
 }
Esempio n. 30
0
 public virtual void Init()
 {
     _path = GameManager.Instance.EnemyPathProvider.GetPath();
     transform.position = _path.Move(0, 0);
     EnemyGrid.InitPosition(this);
 }
    void Update()
    {
        bulspd              -= Time.deltaTime;
        bulspd2             -= Time.deltaTime;
        stunningBulletspeed -= Time.deltaTime;
        GameObject[] enemies = GameObject.FindGameObjectsWithTag(EnemyTag);
        //where the enemy is
        float      enemyPlace  = Mathf.Infinity;
        GameObject TargetEnemy = null;

        foreach (GameObject Enemy in enemies)
        {
            EnemyPath E_Path          = Enemy.GetComponent <EnemyPath>();
            bool      IsEnemyFlying   = Enemy.GetComponent <EnemyStats>().Flying;
            float     distanceToEnemy = Vector2.Distance(transform.position, Enemy.transform.position);

            if (distanceToEnemy <= range)
            {
                enemyPlace   = distanceToEnemy;
                ClosestEnemy = E_Path.distanceTravelled;
                if (ClosestEnemy > ClosestTarget)
                {
                    if (CanHitEnemyWithFlying == false && IsEnemyFlying == true)
                    {
                        TargetEnemy = null;
                        target      = null;
                    }
                    else
                    {
                        TargetEnemy = Enemy;
                    }
                }
                if (enemyPlace > distanceToEnemy)
                {
                    TargetEnemy   = null;
                    ClosestTarget = 0;
                }
            }
            else
            {
                TargetEnemy = null;
                target      = null;
            }


            if (TargetEnemy != null)
            {
                target = Enemy.transform;


                if (bulspd <= 0f)
                {
                    ShootCounter++;
                    Shoot();

                    if (ShootCounter >= Stats.ammo_Capacity)
                    {
                        bulspd       = Stats.Reload;
                        ShootCounter = 0;
                    }
                    else
                    {
                        bulspd = fireCD;
                    }
                }
                if (bulspd2 <= 0f && SecondFirePoint == true)
                {
                    ShootSecondCounter++;
                    ShootSecondFirePoint();

                    if (ShootSecondCounter >= Stats.ammo_Capacity2)
                    {
                        bulspd2            = Stats.Reload2;
                        ShootSecondCounter = 0;
                    }
                    else
                    {
                        bulspd2 = fireCD2;
                    }
                }
                if (stunningBulletspeed <= 0f && StunFirePoint == true)
                {
                    StunsecondCounter++;
                    ShootStunFirePoint();

                    if (StunsecondCounter >= Stats.Stun_ammo_Capacity)
                    {
                        stunningBulletspeed = Stats.StunReload;
                        StunsecondCounter   = 0;
                    }
                    else
                    {
                        stunningBulletspeed = fireCDStun;
                    }
                }
            }
        }
    }
Esempio n. 32
0
 // Start is called before the first frame update
 void Start()
 {
     trash = GameObject.Find("Trash");
     EP    = FindObjectOfType <EnemyPath>();
 }