示例#1
0
        public void DestroyCube(DestroyCubeCommand command)
        {
            Vector3 pos            = command.pos;
            int     overkillDamage = command.overkillDamage;

            if (command.cube != null)
            {
                a_System.InvokeCubeDestroyedEvent(command.cube);
                Destroy(command.cube.gameObject);
                cubes.Remove(command.cube.transform.position);
            }
            int primaryDamage = overkillDamage / 3;

            //spawn direct neighbours - primary spawn
            spawnCubeCommandBuffer.Add(new SpawnCubeCommand(cubePrefab, new Vector3(pos.x - 1 * cubeScale, pos.y, pos.z), AddCubeToList, true, primaryDamage));
            spawnCubeCommandBuffer.Add(new SpawnCubeCommand(cubePrefab, new Vector3(pos.x + 1 * cubeScale, pos.y, pos.z), AddCubeToList, true, primaryDamage));
            spawnCubeCommandBuffer.Add(new SpawnCubeCommand(cubePrefab, new Vector3(pos.x, pos.y, pos.z - 1 * cubeScale), AddCubeToList, true, primaryDamage));
            spawnCubeCommandBuffer.Add(new SpawnCubeCommand(cubePrefab, new Vector3(pos.x, pos.y, pos.z + 1 * cubeScale), AddCubeToList, true, primaryDamage));
            spawnCubeCommandBuffer.Add(new SpawnCubeCommand(cubePrefab, new Vector3(pos.x, pos.y + 1 * cubeScale, pos.z), AddCubeToList, true, primaryDamage));
            spawnCubeCommandBuffer.Add(new SpawnCubeCommand(cubePrefab, new Vector3(pos.x, pos.y - 1 * cubeScale, pos.z), AddCubeToList, true, primaryDamage));
            //spawn Diagonally - secondary spawn
            int secondaryDamage = overkillDamage / 4;

            spawnCubeCommandBuffer.Add(new SpawnCubeCommand(cubePrefab, new Vector3(pos.x - 1 * cubeScale, pos.y, pos.z - 1 * cubeScale), AddCubeToList, true, secondaryDamage));
            spawnCubeCommandBuffer.Add(new SpawnCubeCommand(cubePrefab, new Vector3(pos.x - 1 * cubeScale, pos.y, pos.z + 1 * cubeScale), AddCubeToList, true, secondaryDamage));
            spawnCubeCommandBuffer.Add(new SpawnCubeCommand(cubePrefab, new Vector3(pos.x + 1 * cubeScale, pos.y, pos.z - 1 * cubeScale), AddCubeToList, true, secondaryDamage));
            spawnCubeCommandBuffer.Add(new SpawnCubeCommand(cubePrefab, new Vector3(pos.x + 1 * cubeScale, pos.y, pos.z + 1 * cubeScale), AddCubeToList, true, secondaryDamage));
            spawnCubeCommandBuffer.Add(new SpawnCubeCommand(cubePrefab, new Vector3(pos.x, pos.y + 1 * cubeScale, pos.z - 1 * cubeScale), AddCubeToList, true, secondaryDamage));
            spawnCubeCommandBuffer.Add(new SpawnCubeCommand(cubePrefab, new Vector3(pos.x, pos.y + 1 * cubeScale, pos.z + 1 * cubeScale), AddCubeToList, true, secondaryDamage));
            spawnCubeCommandBuffer.Add(new SpawnCubeCommand(cubePrefab, new Vector3(pos.x, pos.y - 1 * cubeScale, pos.z - 1 * cubeScale), AddCubeToList, true, secondaryDamage));
            spawnCubeCommandBuffer.Add(new SpawnCubeCommand(cubePrefab, new Vector3(pos.x, pos.y - 1 * cubeScale, pos.z + 1 * cubeScale), AddCubeToList, true, secondaryDamage));
            //tertiary spawn
            int tertiaryDamage = overkillDamage / 5;

            spawnCubeCommandBuffer.Add(new SpawnCubeCommand(cubePrefab, new Vector3(pos.x - 1 * cubeScale, pos.y + 1 * cubeScale, pos.z - 1 * cubeScale), AddCubeToList, true, tertiaryDamage));
            spawnCubeCommandBuffer.Add(new SpawnCubeCommand(cubePrefab, new Vector3(pos.x - 1 * cubeScale, pos.y + 1 * cubeScale, pos.z + 1 * cubeScale), AddCubeToList, true, tertiaryDamage));
            spawnCubeCommandBuffer.Add(new SpawnCubeCommand(cubePrefab, new Vector3(pos.x + 1 * cubeScale, pos.y - 1 * cubeScale, pos.z - 1 * cubeScale), AddCubeToList, true, tertiaryDamage));
            spawnCubeCommandBuffer.Add(new SpawnCubeCommand(cubePrefab, new Vector3(pos.x + 1 * cubeScale, pos.y - 1 * cubeScale, pos.z + 1 * cubeScale), AddCubeToList, true, tertiaryDamage));
            spawnCubeCommandBuffer.Add(new SpawnCubeCommand(cubePrefab, new Vector3(pos.x + 1 * cubeScale, pos.y + 1 * cubeScale, pos.z - 1 * cubeScale), AddCubeToList, true, tertiaryDamage));
            spawnCubeCommandBuffer.Add(new SpawnCubeCommand(cubePrefab, new Vector3(pos.x + 1 * cubeScale, pos.y + 1 * cubeScale, pos.z + 1 * cubeScale), AddCubeToList, true, tertiaryDamage));
            spawnCubeCommandBuffer.Add(new SpawnCubeCommand(cubePrefab, new Vector3(pos.x - 1 * cubeScale, pos.y - 1 * cubeScale, pos.z - 1 * cubeScale), AddCubeToList, true, tertiaryDamage));
            spawnCubeCommandBuffer.Add(new SpawnCubeCommand(cubePrefab, new Vector3(pos.x - 1 * cubeScale, pos.y - 1 * cubeScale, pos.z + 1 * cubeScale), AddCubeToList, true, tertiaryDamage));
        }
示例#2
0
 public void AddDestroyCubeCommandToBuffer(DestroyCubeCommand command)
 {
     destroyCubeCommandBuffer.Add(command);
 }