Esempio n. 1
0
        public static Wave GenerateWave(Vector3 emitterPosition, bool rtl = false)
        {
            Wave newWave = waves[waveNumber];

            newWave.path = MovementPaths.CreateSnakePath(emitterPosition, width, rightToLeft: rtl);
            waveNumber++;
            waveNumber = Math.Min(waveNumber, waves.Count - 1);
            return(newWave);
        }
Esempio n. 2
0
    public void SplitEnemy()
    {
        GameObject left  = CreateSplitInstance();
        GameObject right = CreateSplitInstance();
        //get number of levels till end
        Vector2 indices = GetCurrentPathLocation();
        float   points  = pathList.Count - 2 - indices.x;      // number of points

        points = (float)Math.Ceiling(points / 4);

        List <Vector3> leftPath = MovementPaths.CreateSnakePath(transform.localPosition,
                                                                new Vector2(-1.8f, 1.8f),
                                                                levels: (int)points,
                                                                rightToLeft: RightToLeft);
        List <Vector3> rightPath = MovementPaths.CreateSnakePath(transform.localPosition,
                                                                 new Vector2(-1.8f, 1.8f),
                                                                 levels: (int)points,
                                                                 rightToLeft: !RightToLeft);

        float timeLeft = duration - GetPassedTimeSinceCreated();

        left.GetComponent <Enemy>().StartMotion(leftPath, timeLeft, pathList);
        right.GetComponent <Enemy>().StartMotion(rightPath, timeLeft, pathList);
    }