Beispiel #1
0
    public void CreateProjectile(List <HexCell> cells, int cellEffect)
    {
        // cellEffect = 0 = nothing
        // cellEffect = 1 = water
        // cellEffect = 2 = fire
        // cellEffect = 10 = no bounce

        projectile.projectileMovement = 100;
        HexCell cell   = cells[0];
        int     bounce = 0;


        if (cell)
        {
            grid.AddProjectile(Instantiate(projectile), cell, Random.Range(0f, 360f));
            // cell.Projectile.gameObject.GetComponentsInChildren<>
            WaterMoving = true;

            for (int i = 1; i < cells.Count; i++)
            {
                Debug.Log("Loop goes off");
                grid.FindPath(cells[bounce], cells[bounce + 1], projectile.projectileMovement);
                cell.Projectile.Travel(grid.GetPath());
                bounce++;
            }
            MaxBounce         = bounce;
            CellsToBeAffected = cells;
            HexCell LastCell = cells.Last();
            // if (cellEffect == 10)
            // {
            //     CellsToBeAffected[1].Projectile.DestroyProjectile();
            // }
            // else
            // {
            LastCell.Projectile.DestroyProjectile();
            //  }
        }
    }